# gunicorn.conf.py (Should be fine as is) import os # UvicornWorker is correct for ASGI (Starlette) worker_class = 'uvicorn.workers.UvicornWorker' # Can potentially increase workers if the lifespan init is robust # Start with 1 on free tiers to conserve memory, test with more if needed workers = int(os.environ.get('GUNICORN_WORKERS', '1')) bind = f"0.0.0.0:{os.environ.get('PORT', '7860')}" # PORT is standard on HF # Optional: Increase timeout if startup/requests are slow # timeout = 120 # Log levels can also be set here, but rely on code/Uvicorn settings first # loglevel = 'info' # Point Gunicorn to the ASGI app instance (ensure filename matches) # This is usually done in the command line: gunicorn main:app -c gunicorn.conf.py # No need to set 'app' variable here.