agroveda / README.md
Jeeva
docs: add prominent live demo badges and URL to README
5574d97
|
Raw
History Blame Contribute Delete
6.77 kB
metadata
title: Agroveda
emoji: ๐ŸŒฟ
colorFrom: green
colorTo: green
sdk: docker
app_port: 7860
pinned: true

๐ŸŒฟ AgroVeda - AI-Powered Agricultural Expert System


AgroVeda is a premium, high-performance agricultural expert web application designed to empower farmers and agronomists with real-time AI crop consultation, clinical-grade plant disease detection, localized agricultural weather analytics, and cloud database persistence.


โœจ Key Features

๐ŸŽ™๏ธ Multi-Lingual AI Expert Advisor

  • Powered by Groq (Llama 3.3 70B) for lightning-fast, comprehensive, and educational agricultural guidance.
  • Out-of-the-box support for both English and Tamil (เฎคเฎฎเฎฟเฎดเฏ).
  • Explains plant diseases through biological causes, symptoms, and step-by-step organic or chemical treatment protocols.

๐Ÿฉบ AgroVision AI (Vision Model)

  • Integrated TensorFlow image classifier (agroveda_crop_model.h5) trained on the PlantVillage dataset.
  • Automatically analyzes and diagnoses crop health and pest infections (e.g., Early Blight, Late Blight, Leaf Mold, Bacterial Spot, Spider Mites) from user-uploaded images.

๐ŸŒฆ๏ธ Localized Micro-Climate Weather Hub

  • Auto-Location: Detects farm coordinates via browser geolocation.
  • Micro-Climate Zones: Fetches live weather conditions for the selected city and lists temperatures for 5+ surrounding agricultural sub-stations.
  • 24h Forecast: Smooth scrollable hourly temperature and condition tracker.

๐Ÿ” Supabase Cloud Integration

  • User Authentication: Secure Sign Up and Sign In flows with configurable email confirmation settings.
  • Persistent Settings: User name, region, role, default soil type, and weather alert preferences are saved t o the cloud.
  • AI Optimization: Dynamically outputs personalized, localized agricultural advice based on the user's soil type and location.
  • Chat Logs: Automatically saves and restores conversation history for each authenticated user session.
  • Cloud Storage: Uploads uploaded crop images to a Supabase Storage bucket (plant_images) for persistent retrieval.

๐ŸŽจ Premium User Interface

  • Organic Palette: Clean, simple, gentle light-green theme tailored for agricultural applications (using primary #3b6e4c and secondary #557a5e green tones).
  • Glassmorphic Design: Modern, responsive layout featuring quick-access sidebar, dynamic state badges, and interactive profile/notification dropdowns.

โš™๏ธ Technology Stack

  • Backend: Flask (Python)
  • AI/ML: Groq API (LLM inference), TensorFlow (Local computer vision classification)
  • Database & Auth: Supabase (PostgreSQL DB, Auth, Object Storage)
  • Frontend: Vanilla HTML5, CSS3, Tailwind CSS (Form controls), Google Material Symbols

๐Ÿš€ Installation & Local Setup

1. Clone & Environment Setup

Clone the repository to your local machine and set up a virtual environment:

git clone <your-repository-url>
cd agri_chat_bot
python -m venv venv

2. Activate & Install Dependencies

  • Windows:
    venv\Scripts\activate
    pip install -r requirements.txt
    
  • Linux/macOS:
    source venv/bin/activate
    pip install -r requirements.txt
    

3. Database Schema Setup

Execute the following schema in your Supabase SQL Editor to create the tables and configure Row Level Security (RLS) policies:

-- Create Profiles Table
create table public.profiles (
  id uuid references auth.users on delete cascade primary key,
  full_name text not null,
  role text not null default 'Farmer',
  location text default 'Madurai, Tamil Nadu',
  soil_type text default 'Alluvial Soil',
  weather_alerts boolean default true,
  updated_at timestamp with time zone default timezone('utc'::text, now()) not null
);

alter table public.profiles enable row level security;

create policy "Users can view and edit their own profiles." 
  on public.profiles for all 
  using (auth.uid() = id);

-- Create Chats Table
create table public.chats (
  id uuid default gen_random_uuid() primary key,
  user_id uuid references auth.users on delete cascade not null,
  message text not null,
  is_user boolean not null,
  image_url text,
  created_at timestamp with time zone default timezone('utc'::text, now()) not null
);

alter table public.chats enable row level security;

create policy "Users can view and create their own chat history." 
  on public.chats for all 
  using (auth.uid() = user_id);

4. Storage Bucket Setup

  1. In your Supabase dashboard, go to Storage.
  2. Create a new bucket named plant_images.
  3. Set the bucket privacy setting to Public (so public URLs can be fetched).

5. Environment Variables

Create a .env file in the root folder of the project:

GROQ_API_KEY=your_groq_api_key
WEATHER_API_KEY=your_openweathermap_api_key

6. Run Local Server

python app.py

Open http://127.0.0.1:5000 in your web browser.


โ˜๏ธ Deployment on Hugging Face Spaces

The repository is configured for free production deployment on Hugging Face Spaces using the Docker SDK:

  1. Docker Containerization: Includes a Dockerfile configuring the python environment, installing dependencies, and exposing port 7860.
  2. Git LFS Enabled: Large files like the TensorFlow model (.h5) and image assets are configured to be stored via Git Large File Storage (LFS).
  3. Deployment Steps:
    • Create a New Space on Hugging Face.
    • Choose Docker as the Space SDK and Blank as the template.
    • Add your Hugging Face Space repository as a Git remote:
      git remote add hf https://huggingface.co/spaces/<YOUR_HF_USERNAME>/<SPACE_NAME>
      
    • Push your code:
      git push -f hf main
      
    • Go to your Space Settings, scroll to Variables and secrets, and add your secrets:
      • GROQ_API_KEY
      • WEATHER_API_KEY
    • Hugging Face will build your Docker image and run the application automatically.