#!/bin/bash

# Start script for Viz LLM with Datawrapper integration

echo "🚀 Starting Viz LLM..."
echo ""

# Check for required environment variables
if [ ! -f .env ]; then
    echo "⚠️  Error: .env file not found!"
    echo "Please create a .env file based on .env.example"
    exit 1
fi

# Check if required packages are installed
echo "📦 Checking dependencies..."
python -c "import gradio; import datawrapper; import pandas; import mcp" 2>/dev/null
if [ $? -ne 0 ]; then
    echo "⚠️  Some dependencies are missing. Installing..."
    pip install -r requirements.txt
fi

echo ""
echo "✓ Dependencies OK"
echo ""
echo "Starting Gradio app..."
echo "Once started, open your browser to: http://localhost:7860"
echo ""

# Run the app
python app.py
