File size: 610 Bytes
e59dc66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
set -e

# Load environment variables
source .env

# Check if we should run in UI or API mode
if [ "$ENABLE_UI" = "true" ]; then
    echo "Starting Gradio UI with API backend..."
    exec python app.py --api-server &
    sleep 5  # Give the API server time to start
    exec python app.py
elif [ "$API_ONLY" = "true" ]; then
    echo "Starting API server only..."
    exec gunicorn --bind 0.0.0.0:$PORT --workers 1 --timeout 300 "image_descriptor:app"
else
    # Default behavior for Hugging Face Spaces: run both
    echo "Starting service in Hugging Face Spaces mode..."
    exec python app.py
fi