Spaces:
Runtime error
Runtime error
gevent for hf
Browse files- app.py +6 -1
- requirements.txt +3 -1
app.py
CHANGED
|
@@ -20,6 +20,9 @@ import uuid
|
|
| 20 |
import concurrent.futures
|
| 21 |
from scripts.process_utils import *
|
| 22 |
|
|
|
|
|
|
|
|
|
|
| 23 |
app = Flask(__name__)
|
| 24 |
# app.secret_key = 'super_secret_key'
|
| 25 |
CORS(app)
|
|
@@ -259,4 +262,6 @@ if __name__ == '__main__':
|
|
| 259 |
args = parser.parse_args()
|
| 260 |
|
| 261 |
initialize(args.use_local, args.use_gpu, args.use_dotenv)
|
| 262 |
-
|
|
|
|
|
|
|
|
|
| 20 |
import concurrent.futures
|
| 21 |
from scripts.process_utils import *
|
| 22 |
|
| 23 |
+
from gevent import pywsgi
|
| 24 |
+
from geventwebsocket.handler import WebSocketHandler
|
| 25 |
+
|
| 26 |
app = Flask(__name__)
|
| 27 |
# app.secret_key = 'super_secret_key'
|
| 28 |
CORS(app)
|
|
|
|
| 262 |
args = parser.parse_args()
|
| 263 |
|
| 264 |
initialize(args.use_local, args.use_gpu, args.use_dotenv)
|
| 265 |
+
port = int(os.environ['PORT']) if 'PORT' in os.environ else 5000
|
| 266 |
+
server = pywsgi.WSGIServer(('0.0.0.0', port), app, handler_class=WebSocketHandler)
|
| 267 |
+
server.serve_forever()
|
requirements.txt
CHANGED
|
@@ -20,4 +20,6 @@ pytorch_lightning
|
|
| 20 |
python-dotenv
|
| 21 |
peft==0.11.1
|
| 22 |
flask_limiter==3.7.0
|
| 23 |
-
redis==5.0.7
|
|
|
|
|
|
|
|
|
| 20 |
python-dotenv
|
| 21 |
peft==0.11.1
|
| 22 |
flask_limiter==3.7.0
|
| 23 |
+
redis==5.0.7
|
| 24 |
+
gevent==24.2.1
|
| 25 |
+
gevent-websocket==0.10.1
|