htmlpdf / start.sh
ABDALLALSWAITI's picture
Update start.sh
02c7b7c verified
#!/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