#!/bin/bash

# IT Site Survey AI - Startup Script

# Check if virtual environment exists
if [ ! -d "venv" ]; then
    echo "Creating virtual environment..."
    python3 -m venv venv
fi

# Activate virtual environment
source venv/bin/activate

# Install dependencies if needed
echo "Checking dependencies..."
pip install -q -r requirements.txt

# Get port from argument or default to 5000
PORT=${1:-5000}

echo "Starting IT Site Survey AI on port $PORT..."
echo "Open http://localhost:$PORT in your browser"
echo ""
echo "Press Ctrl+C to stop"

# Start the application
python app.py $PORT
