File size: 1,622 Bytes
509a107 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
#!/bin/bash
echo "Starting FastVLM-7B Screen Observer..."
echo "======================================="
# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo "Error: Python 3 is not installed"
exit 1
fi
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo "Error: Node.js is not installed"
exit 1
fi
# Install backend dependencies if needed
echo ""
echo "Setting up backend..."
cd backend
if [ ! -d "venv" ]; then
echo "Creating virtual environment..."
python3 -m venv venv
fi
echo "Activating virtual environment..."
source venv/bin/activate
echo "Installing Python dependencies..."
pip install -r requirements.txt
# Start backend in background
echo ""
echo "Starting FastAPI backend on http://localhost:8000..."
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload &
BACKEND_PID=$!
# Install frontend dependencies if needed
echo ""
echo "Setting up frontend..."
cd ../frontend
if [ ! -d "node_modules" ]; then
echo "Installing Node dependencies..."
npm install --cache /tmp/npm-cache
fi
# Start frontend
echo ""
echo "Starting React frontend on http://localhost:5173..."
npm run dev &
FRONTEND_PID=$!
echo ""
echo "======================================="
echo "Application started successfully!"
echo ""
echo "Frontend: http://localhost:5173"
echo "Backend API: http://localhost:8000"
echo "API Docs: http://localhost:8000/docs"
echo ""
echo "Press Ctrl+C to stop all services"
echo "======================================="
# Wait for Ctrl+C
trap "echo 'Shutting down...'; kill $BACKEND_PID $FRONTEND_PID; exit" INT
wait |