Quantum-API / start.sh
subatomicERROR's picture
πŸ”§ Make start.sh Hugging Face-compatible and update .gitignore
16c76cc
raw
history blame
803 Bytes
#!/bin/bash
echo "πŸš€ Activating Quantum-API Startup"
# Start FastAPI in background on port 7860
echo "πŸŒ€ Starting FastAPI (API backend) on port 7860..."
uvicorn api.main:app --host 0.0.0.0 --port 7860 &> fastapi.log &
# Capture PID for later kill
FASTAPI_PID=$!
# Wait a bit to ensure it starts
sleep 3
# Check if FastAPI is running
if ! ps -p $FASTAPI_PID > /dev/null; then
echo "❌ FastAPI failed to start. Logs:"
cat fastapi.log
exit 1
else
echo "βœ… FastAPI is running as PID $FASTAPI_PID"
fi
# Start Streamlit in foreground (required by Hugging Face)
echo "✨ Launching Streamlit frontend on port 7860 (Hugging Face expects this)..."
streamlit run app/app.py --server.port 8000
# Optional cleanup
echo "🧹 Shutting down FastAPI PID $FASTAPI_PID..."
kill $FASTAPI_PID