ABDALLALSWAITI commited on
Commit
02c7b7c
Β·
verified Β·
1 Parent(s): 1a525d7

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +39 -9
start.sh CHANGED
@@ -1,11 +1,41 @@
1
  #!/bin/bash
2
 
3
- echo "πŸš€ Starting HTML to PDF Converter - Streamlit Mode"
4
-
5
- # Run Streamlit on port 7860 (Hugging Face default)
6
- streamlit run src/streamlit_app.py \
7
- --server.port=7860 \
8
- --server.address=0.0.0.0 \
9
- --server.headless=true \
10
- --server.fileWatcherType=none \
11
- --browser.gatherUsageStats=false
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  #!/bin/bash
2
 
3
+ # Startup script that combines FastAPI and Streamlit on port 7860
4
+
5
+ echo "πŸš€ Starting HTML to PDF Converter (Combined Mode)..."
6
+
7
+ # Start FastAPI in background on port 7860
8
+ echo "πŸ“‘ Starting FastAPI API on port 7860..."
9
+ uvicorn api:app --host 0.0.0.0 --port 7860 &
10
+ API_PID=$!
11
+
12
+ # Give API time to start
13
+ sleep 2
14
+
15
+ # Start Streamlit on port 8501 in background
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
+ echo "βœ… Services started!"
21
+ echo " - FastAPI API: Port 7860"
22
+ echo " - Streamlit UI: Port 8501"
23
+ echo ""
24
+ echo "🌐 Access:"
25
+ echo " - API Docs: http://localhost:7860/docs"
26
+ echo " - API Health: http://localhost:7860/health"
27
+ echo " - Streamlit: http://localhost:8501"
28
+
29
+ # Function to handle shutdown
30
+ cleanup() {
31
+ echo ""
32
+ echo "πŸ›‘ Shutting down services..."
33
+ kill $API_PID $STREAMLIT_PID 2>/dev/null
34
+ exit 0
35
+ }
36
+
37
+ # Trap termination signals
38
+ trap cleanup SIGTERM SIGINT
39
+
40
+ # Wait for both processes
41
+ wait $API_PID $STREAMLIT_PID