Skip to content

abdulmumeen-abdullahi/FarmConsultAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌾 FarmConsultAI – An Intelligent Assistant for Better Farming Decisions

Python Streamlit PyTorch Scikit-learn

FarmConsultAI Home Page

Agriculture is the backbone of food security, yet millions of farmers—especially in developing regions like Nigeria—struggle with unpredictable weather, crop diseases, and limited access to expert advice. I built FarmConsultAI to tackle these critical challenges by putting the power of AI directly into the hands of farmers.

🔗 Live Demo: farmconsultai.streamlit.app

💡 Project Overview

FarmConsultAI is an intelligent, AI-powered web application designed to help farmers, agropreneurs, and agri-investors make smarter, data-driven decisions. It integrates machine learning, computer vision, and generative AI to provide a holistic farm advisory service.

Key Features

  • 📈 Crop Yield Prediction: A Random Forest Regressor model predicts crop yield in tons/hectare based on soil type, weather conditions, and Nitrogen level.
  • 🌿 Crop Disease Diagnosis: An EfficientNet-B3 computer vision model detects and classifies diseases from uploaded crop leaf images with high accuracy.
  • 💬 AI-Powered Advice: Google's Gemini provides actionable recommendations and conversational follow-ups, explaining complex insights in simple, local-friendly language.
  • 🖥️ Interactive Web App: A user-friendly interface built with Streamlit makes these powerful tools accessible on any device with an internet connection.

Yield Prediction Input Yield Prediction Output

Disease Detection Input Disease Detection Output

🛠️ Tech Stack & Architecture

This project combines multiple AI disciplines into a seamless user experience.

  • Frontend: Streamlit
  • Yield Prediction: Scikit-learn, Pandas, NumPy
  • Disease Diagnosis: PyTorch, TIMM (PyTorch Image Models)
  • Generative AI & Chat: Google Generative AI (Gemini)
  • Deployment: Streamlit Community Cloud

The application follows a simple, effective architecture:

  1. The Streamlit UI captures user inputs (form data for yield, images for diseases).
  2. The inputs are processed and fed into the appropriate backend model (Random Forest or EfficientNet-B3).
  3. The model's prediction is passed to the Gemini API along with a structured prompt.
  4. Gemini generates a detailed, easy-to-understand explanation and actionable advice.
  5. The final output and conversational chat interface are rendered back to the user in the Streamlit app.

🚀 Installation & Usage

To run this project locally, follow these steps:

  1. Clone the repository:
    git clone https://github.com/abdulmumeen-abdullahi/FarmConsultAI.git
    cd FarmConsultAI
  2. Install the required dependencies:
    pip install -r requirements.txt
  3. Set up your API keys: Create a .streamlit/secrets.toml file and add your Gemini API key:
    GEMINI_API_KEY = "YOUR_API_KEY_HERE"
  4. Run the Streamlit app:
    streamlit run streamlit_app.py

🎯 Impact & Relevance

FarmConsultAI directly addresses several UN Sustainable Development Goals (SDGs):

  • SDG 1 (No Poverty): By improving farm productivity and reducing crop losses.
  • SDG 2 (Zero Hunger): Helping farmers grow more and waste less to feed communities.
  • SDG 13 (Climate Action): Promoting climate-smart agriculture through informed decision-making.

In Nigeria, where farmers often lack access to timely agronomic expertise, this app bridges a critical knowledge gap. It democratizes access to AI-driven insights that were once out of reach, empowering a new generation of farmers.


🔗 Project Resources