#!/bin/bash # This script runs when the HuggingFace space starts # Set environment variables export FLASK_APP=app.py export FLASK_ENV=production # Start the Flask application with gunicorn # - workers: Number of worker processes (2-4 x CPU cores is recommended) # - timeout: Worker timeout in seconds # - access-logfile: Log access to stdout # - error-logfile: Log errors to stderr exec gunicorn --workers=2 --timeout=120 --bind 0.0.0.0:5000 --access-logfile=- --error-logfile=- app:app