#!/bin/bash echo "Starting FastAPI backend on port 8000..." python stream_api.py 2>&1 & echo "Waiting for FastAPI backend to initialize..." until curl --output /dev/null --silent --fail http://127.0.0.1:8000/health; do printf '.' sleep 1 done echo "" echo "Backend is ready! Launching Gradio UI on port 7860..." # Running this in the foreground keeps the container alive and streams UI logs exec python gradio_3i1_new.py