Spaces:
Running
Running
File size: 896 Bytes
4980686 7e6c7e8 4980686 7e6c7e8 4980686 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #!/bin/bash
set -u
export TRANSLATE_API_URL="${TRANSLATE_API_URL:-http://127.0.0.1:8000/translate}"
echo "Starting FastAPI backend on port 8000..."
uvicorn backend.fastapi_app:app --host 0.0.0.0 --port 8000 &
BACKEND_PID=$!
echo "Waiting for FastAPI health check..."
BACKEND_READY=false
for _ in {1..30}; do
if ! kill -0 "$BACKEND_PID" 2>/dev/null; then
echo "FastAPI backend exited before becoming ready."
break
fi
if curl -fsS http://127.0.0.1:8000/health >/dev/null 2>&1; then
BACKEND_READY=true
echo "FastAPI backend is ready."
break
fi
sleep 1
done
if [ "$BACKEND_READY" != "true" ]; then
echo "Continuing with Streamlit; local translator fallback will be used if API calls fail."
fi
echo "Starting Streamlit frontend on port 7860..."
streamlit run frontend/streamlit_app.py --server.port 7860 --server.address 0.0.0.0
|