ruslanmv commited on
Commit
4648733
1 Parent(s): 4ae2c8b
Files changed (3) hide show
  1. Dockerfile +2 -2
  2. app.py +5 -1
  3. requirements.txt +1 -0
Dockerfile CHANGED
@@ -25,5 +25,5 @@ COPY --chown=user . /app
25
  # Expose the application port (7860) for Hugging Face Spaces
26
  EXPOSE 7860
27
 
28
- # Set the command to run the application using Uvicorn
29
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
25
  # Expose the application port (7860) for Hugging Face Spaces
26
  EXPOSE 7860
27
 
28
+ # Set the command to run the application using Flask-SocketIO and eventlet
29
+ CMD ["python", "app.py"]
app.py CHANGED
@@ -5,10 +5,14 @@ import matplotlib.pyplot as plt
5
  import base64
6
  from io import BytesIO
7
  import random
 
 
 
 
8
 
9
  app = Flask(__name__)
10
  app.config['SECRET_KEY'] = 'your_secret_key'
11
- socketio = SocketIO(app)
12
 
13
  exams = backend.load_question_sets() # Load available exams
14
  selected_questions = [] # Global variable to store the selected questions
 
5
  import base64
6
  from io import BytesIO
7
  import random
8
+ import eventlet
9
+
10
+ # Force eventlet to be used as the async mode for Flask-SocketIO
11
+ eventlet.monkey_patch()
12
 
13
  app = Flask(__name__)
14
  app.config['SECRET_KEY'] = 'your_secret_key'
15
+ socketio = SocketIO(app, async_mode='eventlet')
16
 
17
  exams = backend.load_question_sets() # Load available exams
18
  selected_questions = [] # Global variable to store the selected questions
requirements.txt CHANGED
@@ -1,3 +1,4 @@
1
  Flask
2
  flask-socketio
 
3
  matplotlib
 
1
  Flask
2
  flask-socketio
3
+ eventlet
4
  matplotlib