This is a Smart Agricultural Yield Advice in Algeria (just experiments)
# Smart Agri-Advisor 🌱
A hybrid crop recommendation system combining classical ML, quantum-inspired algorithms, and RAG-powered LLM insights.
## Features ✨
- **Hybrid Prediction System**
- Classical Machine Learning models
- Quantum-inspired algorithms
- RAG (Retrieval Augmented Generation) powered by FAISS and Grover's Algorithms
- Gemini LLM integration for recommendations
- **Multiple Analysis Modes**
- Model-only predictions
- Historical context analysis (RAG)
- Combined model+RAG analysis
- **Dual Interface**
- REST API (FastAPI)
- Rich CLI interface
## Installation 💻
### Prerequisites
- Python 3.10+
- Gemini API key (optional)
```bash
# Clone repository
git clone
github.com
cd Smart-Agri-Advisor
# Create virtual environment
python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env with your Gemini API key (optional)
```
## Usage 🚀
### CLI Interface
```bash
# Run prediction workflow
python cli.py predict
# Example output:
[bold cyan]Initializing resources...[/bold cyan]
- RAG components loaded
- Preprocessor created
- ML models loaded
- Gemini configured
[bold blue]Enter Agricultural Data[/bold blue]
Temperature (°C): 25.5
Humidity (%): 75
Soil pH: 6.2
Rainfall (mm): 200
Analysis type [model_only/rag_only/model_and_rag]: model_and_rag
```
### API Service
```bash
# Start the API server
uvicorn app.main:app --reload
# API Endpoints:
- GET / : Web interface (actually, it is not working)
- POST /predict : Prediction endpoint
```
### Example API Request
```bash
curl -X POST "
localhost" \
-H "Content-Type: application/json" \
-d '{
"soil_type": "Loamy",
"rainfall_mm": 750.5,
"temperature_celsius": 25.0,
"soil_ph": 6.5,
"soil_health": 7.8,
"fertilizer_used": true,
"irrigation_used": false,
"analysis_type": "model_and_rag"
}'
```
## Conf …