Spaces:
Sleeping
Sleeping
File size: 1,061 Bytes
7fc84ea 02c7b7c |
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 35 36 37 38 39 40 41 |
#!/bin/bash
# Startup script that combines FastAPI and Streamlit on port 7860
echo "π Starting HTML to PDF Converter (Combined Mode)..."
# Start FastAPI in background on port 7860
echo "π‘ Starting FastAPI API on port 7860..."
uvicorn api:app --host 0.0.0.0 --port 7860 &
API_PID=$!
# Give API time to start
sleep 2
# Start Streamlit on port 8501 in background
echo "π¨ Starting Streamlit UI on port 8501..."
streamlit run src/streamlit_app.py --server.port=8501 --server.address=0.0.0.0 &
STREAMLIT_PID=$!
echo "β
Services started!"
echo " - FastAPI API: Port 7860"
echo " - Streamlit UI: Port 8501"
echo ""
echo "π Access:"
echo " - API Docs: http://localhost:7860/docs"
echo " - API Health: http://localhost:7860/health"
echo " - Streamlit: http://localhost:8501"
# Function to handle shutdown
cleanup() {
echo ""
echo "π Shutting down services..."
kill $API_PID $STREAMLIT_PID 2>/dev/null
exit 0
}
# Trap termination signals
trap cleanup SIGTERM SIGINT
# Wait for both processes
wait $API_PID $STREAMLIT_PID |