#!/bin/bash # start.sh # This script starts both the FastAPI server and the Streamlit app. # --- IMPORTANT: Set Twilio credentials --- # These should ideally be passed as environment variables to the Docker container # or set in your deployment environment, NOT hardcoded here in production. # export TWILIO_ACCOUNT_SID="ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # export TWILIO_AUTH_TOKEN="your_auth_token_here" # If not set, the app will fall back to Google's STUN server. # Start FastAPI Whisper server in the background echo "Starting FastAPI Whisper server on port 1990..." uvicorn main:app --host 0.0.0.0 --port 1990 & # Store the PID of the FastAPI server FASTAPI_PID=$! echo "FastAPI Whisper server started with PID: $FASTAPI_PID" # Give FastAPI a moment to start up sleep 5 # Start Streamlit app in the foreground echo "Starting Streamlit app on port 8501..." streamlit run streamlit_app.py --server.port 8501 --server.enableCORS false --server.enableXsrfProtection false # Wait for the FastAPI process to ensure the script doesn't exit if Streamlit crashes wait $FASTAPI_PID echo "All services have stopped."