fmab777 commited on
Commit
9f2782c
·
verified ·
1 Parent(s): 6fb1082

Update gunicorn.conf.py

Browse files
Files changed (1) hide show
  1. gunicorn.conf.py +15 -4
gunicorn.conf.py CHANGED
@@ -1,10 +1,21 @@
1
- # gunicorn.conf.py
2
  import os
3
 
 
4
  worker_class = 'uvicorn.workers.UvicornWorker'
5
 
6
- # Can set back to 2 or more if desired, now that init is in lifespan
 
7
  workers = int(os.environ.get('GUNICORN_WORKERS', '1'))
8
 
9
- bind = f"0.0.0.0:{os.environ.get('PORT', '7860')}"
10
- # timeout = 120 # Optional
 
 
 
 
 
 
 
 
 
 
1
+ # gunicorn.conf.py (Should be fine as is)
2
  import os
3
 
4
+ # UvicornWorker is correct for ASGI (Starlette)
5
  worker_class = 'uvicorn.workers.UvicornWorker'
6
 
7
+ # Can potentially increase workers if the lifespan init is robust
8
+ # Start with 1 on free tiers to conserve memory, test with more if needed
9
  workers = int(os.environ.get('GUNICORN_WORKERS', '1'))
10
 
11
+ bind = f"0.0.0.0:{os.environ.get('PORT', '7860')}" # PORT is standard on HF
12
+
13
+ # Optional: Increase timeout if startup/requests are slow
14
+ # timeout = 120
15
+
16
+ # Log levels can also be set here, but rely on code/Uvicorn settings first
17
+ # loglevel = 'info'
18
+
19
+ # Point Gunicorn to the ASGI app instance (ensure filename matches)
20
+ # This is usually done in the command line: gunicorn main:app -c gunicorn.conf.py
21
+ # No need to set 'app' variable here.