johnwesley756/instance-segmentation
0
1#!/bin/bash2 3# Exit immediately if a command fails4set -e5 6# Cleanup function7cleanup() {8 echo "๐ Shutting down FastAPI..."9 if [ -n "$FASTAPI_PID" ]; then10 kill $FASTAPI_PID 2>/dev/null || true11 fi12 exit 013}14 15# Handle termination signals16trap cleanup SIGTERM SIGINT17 18echo "๐ Starting FastAPI on port 8000..."19uvicorn api:app --host 0.0.0.0 --port 8000 &20FASTAPI_PID=$!21 22# Give FastAPI time to boot23sleep 524 25# Verify FastAPI is running26if kill -0 $FASTAPI_PID 2>/dev/null; then27 echo "โ
FastAPI is running (PID=$FASTAPI_PID)"28else29 echo "โ FastAPI failed to start"30 exit 131fi32 33echo "๐จ Starting Streamlit on port 7860..."34streamlit run app.py \35 --server.port 7860 \36 --server.address 0.0.0.0 \37 --server.headless true \38 --browser.gatherUsageStats false39 40# If Streamlit stops, cleanup41cleanup42 