Loading repository dataβ¦
Loading repository dataβ¦
Nauman123-coder / repository
πΎ AI-powered farm assistant for Pakistani farmers β crop disease detection, autonomous vendor negotiation, logistics mapping & parametric insurance. Built with React, FastAPI & TF.js.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Empowering 8.3 million small-scale Pakistani farmers with AI-driven crop diagnosis, autonomous vendor negotiation, logistics mapping, and parametric insurance β all in one mobile-first app.
Pakistan's agricultural sector contributes ~21% of GDP yet most small-scale farmers lack access to expert agronomic advice, fair market pricing, and timely crop protection. They lose thousands of rupees every season to preventable diseases, unfair vendor deals, and delayed treatments.
KhetAI bridges that gap. Take a photo of your crop β get an AI diagnosis in seconds β negotiate the best pesticide price autonomously β check insurance payout eligibility β find vendors on the map. All in Urdu and English, optimized for low-end Android devices.
π Try KhetAI Live β
Upload any crop leaf photo and watch the AI detect disease, calculate economic loss, and recommend treatment β all within 3 seconds.
| Layer | Technology |
|---|---|
| Component-based UI with hooks | |
| Utility-first styling | |
| Fluid animations & spring physics | |
| In-browser crop disease inference |
| High-performance async Python API |
| llama-3.3-70b streaming chat |
| Lightweight farmer data storage |
| Interactive OSM vendor maps |
| Frontend deployment |
| Backend deployment |
Powered by MobileNetV2 + PlantVillage dataset β runs 100% in your browser
πΈ Upload Photo β π§ TF.js Inference β π¦ Disease Identified β π Treatment Plan
Real-time streaming chat powered by Groq's llama-3.3-70b
AI agent negotiates pesticide prices on your behalf
Monte Carlo simulation with 10,000 iterations
Real OpenStreetMap data via Overpass API
Automated payout based on disease severity threshold
khetai/
βββ π₯οΈ frontend/ # React 18 App
β βββ public/
β β βββ tfjs_model/ # TensorFlow.js model (MobileNetV2)
β β β βββ model.json
β β β βββ group1-shard1of2.bin (4.0 MB)
β β β βββ group1-shard2of2.bin (1.7 MB)
β β βββ class_labels.json # 38 PlantVillage disease classes
β β βββ landing.html # Marketing landing page
β βββ src/
β βββ pages/
β β βββ Dashboard.js # Portfolio & market prices
β β βββ Diagnose.js # Disease detection + chatbot
β β βββ Negotiate.js # Vendor negotiation
β β βββ LogisticsMap.js # OSM vendor map
β β βββ Insurance.js # Parametric insurance
β βββ utils/
β βββ api.js # API calls + mock fallbacks
β βββ voice.js # Web Speech API (Urdu + English)
β
βββ βοΈ backend/ # FastAPI Python App
β βββ main.py # App entry point + CORS
β βββ requirements.txt
β βββ .python-version # Python 3.11.9
β βββ core/
β β βββ config.py # Environment settings
β β βββ database.py # SQLAlchemy + SQLite
β βββ routers/
β β βββ chat.py # π€ Groq streaming chat
β β βββ diagnose.py # Disease diagnosis endpoint
β β βββ negotiate.py # Vendor negotiation
β β βββ economics.py # Monte Carlo simulation
β β βββ logistics.py # Vendor location data
β β βββ insurance.py # Parametric insurance
β β βββ market.py # Crop price feeds
β βββ services/
β βββ grok_service.py # Groq LLM client
β βββ economic_engine.py # NumPy Monte Carlo
β
βββ π README.md
git clone https://github.com/Nauman123-coder/Agri-AI.git
cd Agri-AI
cd backend
python -m venv venv
source venv/Scripts/activate # Windows Git Bash
pip install -r requirements.txt
# Create .env file
echo "GROQ_API_KEY=your_groq_key_here" > .env
echo "SECRET_KEY=any_random_string" >> .env
echo "DATABASE_URL=sqlite:///./khetai.db" >> .env
uvicorn main:app --reload --port 8000
cd frontend
npm install
echo "REACT_APP_API_URL=http://localhost:8000" > .env
npm start
http://localhost:3000
| Service | Platform | URL |
|---|---|---|
| Frontend | Vercel | agri-ai-ruby.vercel.app |
| Backend API | Render | agri-ai-au37.onrender.com |
| API Docs | Swagger UI | /docs |
Vercel (Frontend):
REACT_APP_API_URL = https://agri-ai-au37.onrender.com
Render (Backend):
GROQ_API_KEY = your_groq_api_key
SECRET_KEY = your_secret_key
DATABASE_URL = sqlite:///./khetai.db
PYTHON_VERSION = 3.11.9
| Property | Value |
|---|---|
| Architecture | MobileNetV2 (transfer learning) |
| Dataset | PlantVillage (54,306 images) |
| Classes | 38 disease categories |
| Validation Accuracy | 97.66% |
| Input Size | 224 Γ 224 Γ 3 |
| Inference Engine | TensorFlow.js (in-browser) |
| Model Size | ~5.7 MB (2 shards) |
| Chat LLM | llama-3.3-70b-versatile via Groq |
Pakistan-specific additions beyond PlantVillage:
Punjab β Lahore Β· Faisalabad Β· Multan Β· Rawalpindi Β· Gujranwala Β· Sahiwal Β· Gujrat Β· Okara Β· Bahawalpur Β· Sargodha
Sindh β Karachi Β· Hyderabad Β· Sukkur Β· Larkana
KPK β Peshawar
Balochistan β Quetta
Contributions are very welcome! Especially:
# Fork β Clone β Branch β PR
git checkout -b feature/your-feature-name
git commit -m "feat: describe your change"
git push origin feature/your-feature-name
MIT License β free to use, modify, and distribute with attribution.
Built with β€οΈ for Pakistani farmers by Nauman
"A healthy khet is a healthy economy β Ψ΅ΨΨͺ Ω ΩΨ― Ϊ©ΪΎΫΨͺΨ Ψ΅ΨΨͺ Ω ΩΨ― Ω ΨΉΨ§Ψ΄Ϋ" π±
β Star this repo if KhetAI helped or inspired you!
Made in π΅π° Pakistan Β· Powered by AI Β· Built for Kisaans