Spaces:
Running
Running
Create gunicorn.conf.py
Browse files- gunicorn.conf.py +20 -0
gunicorn.conf.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# gunicorn.conf.py
|
2 |
+
import os
|
3 |
+
|
4 |
+
# Use an asynchronous worker compatible with asyncio
|
5 |
+
# uvicorn.workers.UvicornWorker is generally recommended
|
6 |
+
worker_class = 'uvicorn.workers.UvicornWorker'
|
7 |
+
|
8 |
+
# Number of workers (adjust based on Space resources if needed)
|
9 |
+
workers = int(os.environ.get('GUNICORN_WORKERS', '2')) # Example: default 2
|
10 |
+
|
11 |
+
# Bind to the port specified by Hugging Face Spaces or default
|
12 |
+
bind = f"0.0.0.0:{os.environ.get('PORT', '7860')}"
|
13 |
+
|
14 |
+
# Logging (optional, Gunicorn default logs are usually fine)
|
15 |
+
# loglevel = 'debug'
|
16 |
+
# accesslog = '-' # Log access to stdout
|
17 |
+
# errorlog = '-' # Log errors to stdout
|
18 |
+
|
19 |
+
# Timeout (optional, increase if needed for long requests)
|
20 |
+
# timeout = 120
|