FastAPI backend for agricultural platform with AI-powered features.
Use Python 3.11 for this project. The pinned ML dependencies in requirements.txt
do not currently install correctly on Python 3.14.
git clone https://github.com/devShaik010/KisaanVerse.git
cd KisaanVersepy -3.11 -m venv env.\env\Scripts\Activate.ps1pip install -r requirements.txtpython main.pyAccess API Documentation: http://localhost:8000/docs
KisaanVerse/
├── app/
│ ├── __init__.py
│ ├── config.py # Configuration & API keys
│ ├── models.py # Pydantic request/response models
│ ├── routes.py # API endpoints
│ ├── services.py # Business logic (add your implementations here)
│ └── models/
│ └── croppredict.pkl # ML model files
├── main.py # FastAPI application entry point
├── requirements.txt # Python dependencies
└── README.md
-
Define Models (
app/models.py)- Add Pydantic models for request/response
-
Implement Logic (
app/services.py)- Write your business logic functions
- Integrate ML models, APIs, databases
-
Create Endpoints (
app/routes.py)- Connect routes to services
- Handle requests and responses
-
Configure Settings (
app/config.py)- Add API keys
- Set environment variables
| Method | Endpoint | Purpose | Status |
|---|---|---|---|
| GET | /KV/weather |
Get weather data by location/coordinates | ✅ Working |
| POST | /kv/predictCrop |
Crop recommendation system | |
| POST | /kv/yieldPredict |
Crop yield prediction | |
| GET | /kv/govSchemes |
Government schemes list | |
| POST | /kv/kvLLM |
AI assistant | |
| POST | /kv/BotLLM |
RAG-powered voice bot |
-
Using Swagger UI
- Open: http://localhost:8000/docs
- Click on endpoint → "Try it out" → Fill parameters → Execute
-
Using cURL
# Weather by location curl "http://localhost:8000/KV/weather?location=Bangalore" # Weather by coordinates curl "http://localhost:8000/KV/weather?lat=12.9716&lon=77.5946"
- Backend: FastAPI, Pydantic, Uvicorn
- HTTP Client: httpx (for external APIs)
- Weather: Open-Meteo (free, no API key required)
- Geocoding: Nominatim (free, no API key required)
- Hot reload is enabled - code changes auto-restart server
- Check
/healthendpoint to verify server is running - All endpoints return JSON responses
- Use Swagger UI for interactive API testing
- Implement crop recommendation ML model in
services.py - Add yield prediction logic
- Integrate government schemes web scraping
- Connect GenAI/LLM for AI assistant
- Add database for user data
- Implement authentication
License: MIT