Spaces:
Sleeping
Sleeping
Update start.sh
Browse files
start.sh
CHANGED
|
@@ -1,10 +1,36 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
# Start Streamlit on port 8501
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# Wait for both processes
|
| 10 |
-
wait
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
+
# Startup script to run both FastAPI and Streamlit
|
| 4 |
+
|
| 5 |
+
echo "π Starting HTML to PDF Converter..."
|
| 6 |
+
|
| 7 |
+
# Start FastAPI in the background on port 7860
|
| 8 |
+
echo "π‘ Starting FastAPI API on port 7860..."
|
| 9 |
+
python3 api.py &
|
| 10 |
+
API_PID=$!
|
| 11 |
+
|
| 12 |
+
# Wait a moment for API to start
|
| 13 |
+
sleep 3
|
| 14 |
|
| 15 |
# Start Streamlit on port 8501
|
| 16 |
+
echo "π¨ Starting Streamlit UI on port 8501..."
|
| 17 |
+
streamlit run src/streamlit_app.py --server.port=8501 --server.address=0.0.0.0 &
|
| 18 |
+
STREAMLIT_PID=$!
|
| 19 |
+
|
| 20 |
+
# Function to handle shutdown
|
| 21 |
+
cleanup() {
|
| 22 |
+
echo "π Shutting down services..."
|
| 23 |
+
kill $API_PID $STREAMLIT_PID 2>/dev/null
|
| 24 |
+
exit 0
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
# Trap termination signals
|
| 28 |
+
trap cleanup SIGTERM SIGINT
|
| 29 |
+
|
| 30 |
+
echo "β
Services started!"
|
| 31 |
+
echo " - FastAPI API: http://localhost:7860"
|
| 32 |
+
echo " - FastAPI Docs: http://localhost:7860/docs"
|
| 33 |
+
echo " - Streamlit UI: http://localhost:8501"
|
| 34 |
|
| 35 |
# Wait for both processes
|
| 36 |
+
wait $API_PID $STREAMLIT_PID
|