Download app.py from ParthCodes/flask-react-sockets: direct link, hf CLI and curl.
- Browser
- Download file 535 Bytes
-
https://huggingface.co/spaces/ParthCodes/flask-react-sockets/resolve/main/app.py
- Command line
-
hf download hf://spaces/ParthCodes/flask-react-sockets/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ParthCodes/flask-react-sockets/resolve/main/app.py
535 Bytes
| from flask import Flask, render_template | |
| from flask_socketio import SocketIO | |
| from flask_socketio import emit | |
| from flask_cors import CORS | |
| app = Flask(__name__) | |
| socketio = SocketIO(app, cors_allowed_origins="*") | |
| CORS(app) | |
| app.secret_key = 'flask-sockets-builds' | |
| def index(): | |
| return render_template('index.html') | |
| def handle_message(data): | |
| emit('message', data, broadcast=True) | |
| if __name__ == '__main__': | |
| socketio.run(app, host='0.0.0.0', debug=True, allow_unsafe_werkzeug=True) |