wallpaint / run.sh
aliroohan179's picture
first
6810092 verified
#!/bin/bash
# Wall Color Visualizer Backend Runner Script
echo "🎨 Starting Wall Color Visualizer Backend..."
echo "==========================================="
echo ""
# Check if virtual environment exists
if [ ! -d "venv" ]; then
echo "❌ Virtual environment not found!"
echo "Please run setup.sh first:"
echo " ./setup.sh"
exit 1
fi
# Activate virtual environment
echo "πŸ“¦ Activating virtual environment..."
source venv/bin/activate
# Check if SAM model exists
if [ ! -f "sam_vit_h_4b8939.pth" ] && [ ! -f "sam_vit_l_0b3195.pth" ] && [ ! -f "sam_vit_b_01ec64.pth" ]; then
echo "⚠️ Warning: SAM model not found!"
echo "The API will work with fallback methods but won't have AI segmentation."
echo ""
echo "To download SAM model, run:"
echo " wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth"
echo ""
fi
# Get local IP address
LOCAL_IP=$(hostname -I | awk '{print $1}')
echo "πŸš€ Starting FastAPI server..."
echo ""
echo "Server will be available at:"
echo " - Local: http://localhost:8000"
echo " - Network: http://$LOCAL_IP:8000"
echo " - Health Check: http://localhost:8000/health"
echo " - API Docs: http://localhost:8000/docs"
echo ""
echo "For Flutter app configuration:"
echo " - Android Emulator: http://10.0.2.2:8000"
echo " - iOS Simulator: http://localhost:8000"
echo " - Real Device: http://$LOCAL_IP:8000"
echo ""
echo "Press Ctrl+C to stop the server"
echo "==========================================="
echo ""
# Start server
uvicorn main:app --reload --host 0.0.0.0 --port 8000