mosha255 commited on
Commit
f8336d8
·
unverified ·
1 Parent(s): 50169a4

Apps refactor

Browse files
Files changed (3) hide show
  1. api_app.py +2 -4
  2. spaces_app.py +0 -8
  3. startup.sh +7 -1
api_app.py CHANGED
@@ -77,9 +77,7 @@ def create_api_app():
77
 
78
  return app
79
 
80
- def start_api_app(port=Config.PORT, debug=Config.DEBUG):
81
- app = create_api_app()
82
- app.run(host=Config.HOST, port=port, debug=debug)
83
 
84
  if __name__ == '__main__':
85
- start_api_app()
 
77
 
78
  return app
79
 
80
+ app = create_api_app()
 
 
81
 
82
  if __name__ == '__main__':
83
+ app.run(host=Config.HOST, port=Config.PORT debug=Config.DEBUG)
spaces_app.py CHANGED
@@ -3,9 +3,6 @@ import os
3
  import sys
4
  import logging
5
  import requests
6
- import threading
7
-
8
- from api_app import start_api_app
9
 
10
  # Add the current directory to the path so we can import from app
11
  sys.path.append(os.path.dirname(os.path.abspath(__file__)))
@@ -50,11 +47,6 @@ def create_gradio_interface():
50
  )
51
  return demo
52
 
53
- # Start Gradio in a separate thread
54
- thread = threading.Thread(target=start_api_app)
55
- thread.daemon = True
56
- thread.start()
57
-
58
  app = create_gradio_interface()
59
 
60
  # Launch the app
 
3
  import sys
4
  import logging
5
  import requests
 
 
 
6
 
7
  # Add the current directory to the path so we can import from app
8
  sys.path.append(os.path.dirname(os.path.abspath(__file__)))
 
47
  )
48
  return demo
49
 
 
 
 
 
 
50
  app = create_gradio_interface()
51
 
52
  # Launch the app
startup.sh CHANGED
@@ -11,4 +11,10 @@ if [ $? -ne 0 ]; then
11
  fi
12
 
13
  # Start Gunicorn for the Flask app
14
- gunicorn --bind 0.0.0.0:9090 spaces_app:app
 
 
 
 
 
 
 
11
  fi
12
 
13
  # Start Gunicorn for the Flask app
14
+ gunicorn --bind 0.0.0.0:8080 spaces_app:app &
15
+
16
+ # Start Gunicorn for the Gradio frontend
17
+ gunicorn --bind 0.0.0.0:9090 api_app:app &
18
+
19
+ # Wait for all background processes to finish
20
+ wait