File size: 2,181 Bytes
a9bb92b
 
bfc8b81
 
a9bb92b
bfc8b81
a9bb92b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bfc8b81
 
a9bb92b
 
 
 
 
 
 
 
 
 
 
 
bfc8b81
 
a9bb92b
 
 
 
 
 
 
 
bfc8b81
a9bb92b
 
 
 
 
 
 
bfc8b81
 
a9bb92b
bfc8b81
a9bb92b
 
 
 
 
 
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
69
70
71
72
73
#!/bin/bash

# AgriAI Assistant Setup Script (Global Environment)
# This script sets up the complete agricultural AI system using the current global environment

echo "🌾 Setting up AgriAI Assistant (Global Environment)..."

# Check Python version
python_version=$(python3 --version 2>&1 | awk '{print $2}' | cut -d. -f1,2)
required_version="3.8"

if [ "$(printf '%s\n' "$required_version" "$python_version" | sort -V | head -n1)" != "$required_version" ]; then
    echo "❌ Python 3.8+ is required. Found: $python_version"
    exit 1
fi

# Check Node.js version
node_version=$(node --version 2>&1 | sed 's/v//')
required_node="16.0.0"

if [ "$(printf '%s\n' "$required_node" "$node_version" | sort -V | head -n1)" != "$required_node" ]; then
    echo "❌ Node.js 16+ is required. Found: $node_version"
    exit 1
fi

echo "βœ… System requirements met"

# Setup Backend
echo "πŸ”§ Setting up backend..."
cd backend

# Install Python dependencies in global environment
echo "Installing Python dependencies (global environment)..."
pip install --upgrade pip
pip install -r requirements.txt

# Copy environment file
if [ ! -f .env ]; then
    cp .env.example .env
    echo "πŸ“ Created backend .env file - please configure as needed"
fi

cd ..

# Setup Frontend
echo "πŸ”§ Setting up agriculture-ai-frontend..."
cd agriculture-ai-frontend

# Install Node.js dependencies
echo "Installing Node.js dependencies..."
npm install

# Copy environment file
if [ ! -f .env ]; then
    cp .env.example .env
    echo "πŸ“ Created agriculture-ai-frontend .env file - please configure as needed"
fi

cd ..

echo "βœ… Setup complete!"
echo ""
echo "πŸš€ To start the application:"
echo "1. Start backend: cd backend && uvicorn main:app --reload --host 0.0.0.0 --port 8000"
echo "2. Start frontend: cd agriculture-ai-frontend && npm run dev"
echo ""
echo "πŸ“± Access the frontend at: http://localhost:5173"
echo "πŸ“š API documentation at: http://localhost:8000/docs"
echo ""
echo "⚠️  Important:"
echo "- Configure your .env files with API keys if needed"
echo "- Ensure all ML models are in the models/ directory"
echo "- Check that the backend is running before starting the frontend"