#!/bin/bash # Quickstart script for Plant Disease Detection UI # This script sets up the environment and runs the app echo "🌱 Plant Disease Detection - Quick Start" echo "========================================" echo "" # Check if Python is installed if ! command -v python3 &> /dev/null; then echo "❌ Error: Python 3 is not installed" echo "Please install Python 3.8 or higher" exit 1 fi echo "✓ Python found: $(python3 --version)" echo "" # Check if virtual environment exists if [ ! -d "venv" ]; then echo "📦 Creating virtual environment..." python3 -m venv venv echo "✓ Virtual environment created" else echo "✓ Virtual environment already exists" fi echo "" # Activate virtual environment echo "🔧 Activating virtual environment..." source venv/bin/activate # Install/upgrade dependencies echo "📥 Installing dependencies..." pip install --upgrade pip > /dev/null 2>&1 pip install -r requirements.txt echo "✓ Dependencies installed" echo "" # Check if example images exist if [ ! -d "ui/examples" ] || [ -z "$(ls -A ui/examples 2>/dev/null)" ]; then echo "📸 No example images found" echo "" read -p "Would you like to download example images? (y/n): " -n 1 -r echo "" if [[ $REPLY =~ ^[Yy]$ ]]; then echo "Downloading example images..." python3 download_examples.py echo "" fi fi # Run the app echo "🚀 Starting the application..." echo "" echo "The app will be available at: http://localhost:7860" echo "Press Ctrl+C to stop the server" echo "" echo "========================================" echo "" cd ui python3 app.py