ABDALLALSWAITI commited on
Commit
a75900b
Β·
verified Β·
1 Parent(s): e126d9e

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +30 -4
start.sh CHANGED
@@ -1,10 +1,36 @@
1
  #!/bin/bash
2
 
3
- # Start FastAPI on port 7860 (Hugging Face default)
4
- uvicorn api:app --host 0.0.0.0 --port 7860 &
 
 
 
 
 
 
 
 
 
5
 
6
  # Start Streamlit on port 8501
7
- streamlit run src/streamlit_app.py --server.port=8501 --server.address=0.0.0.0 --server.enableXsrfProtection=false --server.enableCORS=false &
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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