File size: 552 Bytes
46a9232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
set -e

echo "Starting FastAPI server..."
python -m uvicorn app.api.main:app --host 0.0.0.0 --port 8000 &
UVICORN_PID=$!

echo "Waiting for FastAPI to be ready..."
TIMEOUT=30
ELAPSED=0
until curl -sf http://localhost:8000/api/v1/health > /dev/null; do
    if [ $ELAPSED -ge $TIMEOUT ]; then
        echo "ERROR: FastAPI did not start within ${TIMEOUT}s, aborting."
        kill $UVICORN_PID 2>/dev/null
        exit 1
    fi
    sleep 1
    ELAPSED=$((ELAPSED + 1))
done

echo "FastAPI ready. Starting Gradio..."
exec python gradio_app/app.py