ABDALLALSWAITI commited on
Commit
1362dfd
Β·
verified Β·
1 Parent(s): 4c51b8c

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +11 -13
start.sh CHANGED
@@ -1,21 +1,19 @@
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() {
 
1
  #!/bin/bash
2
 
3
+ # Startup script optimized for Hugging Face Spaces
4
+ # HF only exposes port 7860, so we need to choose one service
5
 
6
  echo "πŸš€ Starting HTML to PDF Converter..."
7
 
8
+ # Check if we should run API or Streamlit
9
+ if [ "$RUN_MODE" = "api" ]; then
10
+ echo "πŸ“‘ Starting FastAPI API on port 7860..."
11
+ python3 api.py
12
+ else
13
+ # Default: Run Streamlit (Hugging Face Spaces work best with Streamlit)
14
+ echo "🎨 Starting Streamlit UI on port 7860..."
15
+ streamlit run src/streamlit_app.py --server.port=7860 --server.address=0.0.0.0
16
+ fi
 
 
 
17
 
18
  # Function to handle shutdown
19
  cleanup() {