Spaces:
Running
Running
Update start.sh
Browse files
start.sh
CHANGED
|
@@ -1,21 +1,19 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
-
# Startup script
|
|
|
|
| 4 |
|
| 5 |
echo "π Starting HTML to PDF Converter..."
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
#
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 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() {
|