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

# Get port from environment variable (Hugging Face Spaces sets this)
PORT=${PORT:-7860}

echo "Starting FastAPI application on port $PORT..."

# Verify critical imports before starting
echo "Verifying imports..."
python -c "import sys; sys.path.insert(0, '/app'); import app; print('✓ app.py imported successfully')" || {
    echo "ERROR: Failed to import app.py"
    exit 1
}

# Run the FastAPI application
echo "Starting uvicorn server..."
exec python -m uvicorn app:app --host 0.0.0.0 --port $PORT --log-level info