Skip to content

Adarshyadav03/Smart-Farmer

Repository files navigation

🌾 Smart Farmer Advisory System

An intelligent AI-powered web application to help farmers with crop management, disease detection, weather insights, and expert advice in multiple Indian languages.

✨ Features

  • 🤖 AI Chatbot - Get instant farming advice powered by Google Gemini AI
  • 📷 Crop Disease Detection - Upload photos of crops to identify diseases and get treatment recommendations
  • 🌤️ Weather Integration - Real-time weather data with farming-specific tips
  • 📋 Crop Advisory - Expert tips on soil health, water management, pest control, and more
  • 🌐 Multi-Language Support - Available in English, Hindi, Tamil, Telugu, and Marathi
  • 🎤 Voice Input - Speak your questions for hands-free assistance
  • 🔐 User Authentication - Secure login and registration system

🚀 Quick Start

Prerequisites

  • Python 3.8 or higher
  • Google Gemini API Key
  • OpenWeatherMap API Key (free tier available)

Installation

  1. Clone/Download the project

  2. Install dependencies:

    cd Farmers_Sathi
    pip install -r requirements.txt
  3. Configure API Keys:

    Edit config.py and add your API keys:

    GEMINI_API_KEY = 'your-gemini-api-key'
    WEATHER_API_KEY = 'your-openweathermap-api-key'

    Or create a .env file:

    GEMINI_API_KEY=your-gemini-api-key
    WEATHER_API_KEY=your-openweathermap-api-key
    SECRET_KEY=your-secret-key
    
  4. Run the application:

    python app.py
  5. Open in browser:

    http://localhost:8080
    

📁 Project Structure

Farmers_Sathi/
├── app.py                     # Main Flask application
├── config.py                  # Configuration & API keys
├── requirements.txt           # Python dependencies
├── README.md                  # This file
│
├── database/
│   └── farmer.db              # SQLite database (auto-created)
│
├── models/
│   ├── user.py                # User model & auth
│   └── advisory.py            # Crop advisory data
│
├── services/
│   ├── auth_service.py        # Login/registration logic
│   ├── chatbot_service.py     # AI chatbot & image analysis
│   ├── weather_service.py     # Weather API integration
│   ├── language_service.py    # Multi-language translations
│   └── image_service.py       # Image upload handling
│
├── static/
│   ├── css/
│   │   └── style.css          # Premium UI styles
│   ├── js/
│   │   ├── chatbot.js         # Chat functionality
│   │   └── main.js            # General UI scripts
│   └── uploads/               # User uploaded images
│
└── templates/
    ├── base.html              # Base template
    ├── login.html             # Login page
    ├── register.html          # Registration page
    ├── dashboard.html         # Main dashboard
    ├── chatbot.html           # AI chat interface
    ├── weather.html           # Weather page
    └── advisory.html          # Crop advisory

🔑 Getting API Keys

Google Gemini API

  1. Go to Google AI Studio
  2. Create a new API key
  3. Add it to config.py or .env

OpenWeatherMap API

  1. Sign up at OpenWeatherMap
  2. Get your free API key
  3. Add it to config.py or .env

🌍 Supported Languages

Language Code
English en
Hindi hi
Tamil ta
Telugu te
Marathi mr

📱 Features in Detail

AI Chatbot

  • Ask questions about farming, crops, pests, and diseases
  • Get responses in your preferred language
  • Voice input support for hands-free use
  • Conversation history for context-aware responses

Crop Disease Detection

  • Upload photos of affected crops
  • AI analyzes the image using Google Gemini Vision
  • Get detailed diagnosis with treatment recommendations
  • Works with photos from camera or gallery

Weather Integration

  • Current weather conditions for your location
  • 5-day forecast
  • Farming-specific advice based on weather
  • Alerts for extreme conditions

🛠️ Development

Running in Development Mode

python app.py

The server runs with debug mode enabled for development.

Database

The SQLite database is automatically created when you first run the app.

📝 License

This project is open source and available under the MIT License.

🤝 Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.


Made with ❤️ for Indian Farmers

About

Helping formers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors