Download ffl.py from Pezh/Login: direct link, hf CLI and curl.
- Browser
- Download file 699 Bytes
-
https://huggingface.co/spaces/Pezh/Login/resolve/main/ffl.py
- Command line
-
hf download hf://spaces/Pezh/Login/ffl.py
-
curl -L -o ffl.py https://huggingface.co/spaces/Pezh/Login/resolve/main/ffl.py
699 Bytes
| from flask import Flask, render_template, request, jsonify | |
| app = Flask(__name__) | |
| # This list will be modified when items are added via the 'send' button | |
| list_1 = ['Item 1', 'Item 2', 'Item 3'] | |
| def index(): | |
| return render_template('index.html') | |
| def get_items(): | |
| # Return all items in list_1 as JSON | |
| return jsonify(list_1) | |
| def add_item(): | |
| item = request.json['item'] | |
| if item: # Only add non-empty item | |
| list_1.append(item) | |
| return jsonify({'success': True, 'item': item}) | |
| return jsonify({'success': False}) | |
| if __name__ == '__main__': | |
| app.run(debug=True) |