Spaces:
Paused
Paused
Update start.sh
Browse files
start.sh
CHANGED
|
@@ -1,43 +1,32 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
# Pull the Ollama model if not already available
|
| 19 |
-
# IMPORTANT: This model name must match the MODEL_NAME in main.py
|
| 20 |
-
MODEL_NAME="krishna_choudhary/tinyllama:latest"
|
| 21 |
-
echo "--- Pulling Ollama model: $MODEL_NAME ---"
|
| 22 |
-
ollama pull "$MODEL_NAME"
|
| 23 |
-
|
| 24 |
-
echo "--- Verifying package versions via pip list ---"
|
| 25 |
-
# List installed pip packages and their versions for debugging
|
| 26 |
-
pip list
|
| 27 |
-
echo "--- End pip list verification ---"
|
| 28 |
-
|
| 29 |
-
# Start FastAPI server in the background using uvicorn
|
| 30 |
-
echo "FastAPI server starting..."
|
| 31 |
-
python -m uvicorn main:app --host 0.0.0.0 --port 7860 &
|
| 32 |
FASTAPI_PID=$!
|
| 33 |
-
echo "FastAPI server started with PID: $FASTAPI_PID"
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
-
echo "All services
|
| 42 |
-
# Keep the container running
|
| 43 |
-
wait $FASTAPI_PID $STREAMLIT_PID
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
+
# start.sh
|
| 4 |
+
# This script starts both the FastAPI server and the Streamlit app.
|
| 5 |
+
|
| 6 |
+
# --- IMPORTANT: Set Twilio credentials ---
|
| 7 |
+
# These should ideally be passed as environment variables to the Docker container
|
| 8 |
+
# or set in your deployment environment, NOT hardcoded here in production.
|
| 9 |
+
# export TWILIO_ACCOUNT_SID="ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
| 10 |
+
# export TWILIO_AUTH_TOKEN="your_auth_token_here"
|
| 11 |
+
# If not set, the app will fall back to Google's STUN server.
|
| 12 |
+
|
| 13 |
+
# Start FastAPI Whisper server in the background
|
| 14 |
+
echo "Starting FastAPI Whisper server on port 1990..."
|
| 15 |
+
uvicorn main:app --host 0.0.0.0 --port 1990 &
|
| 16 |
+
|
| 17 |
+
# Store the PID of the FastAPI server
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
FASTAPI_PID=$!
|
|
|
|
| 19 |
|
| 20 |
+
echo "FastAPI Whisper server started with PID: $FASTAPI_PID"
|
| 21 |
+
|
| 22 |
+
# Give FastAPI a moment to start up
|
| 23 |
+
sleep 5
|
| 24 |
+
|
| 25 |
+
# Start Streamlit app in the foreground
|
| 26 |
+
echo "Starting Streamlit app on port 8501..."
|
| 27 |
+
streamlit run streamlit_app.py --server.port 8501 --server.enableCORS false --server.enableXsrfProtection false
|
| 28 |
+
|
| 29 |
+
# Wait for the FastAPI process to ensure the script doesn't exit if Streamlit crashes
|
| 30 |
+
wait $FASTAPI_PID
|
| 31 |
|
| 32 |
+
echo "All services have stopped."
|
|
|
|
|
|