PhytoVigil

🌿 PhytoVigil Backend

Backend for the PhytoVigil application, developed with FastAPI, featuring:

⚙️ Technologies Used

🚀 Running the Project Locally

1. Clone the project

git clone https://github.com/badie16/PhytoVigil.git
cd PhytoVigil/backend

2. Create and activate a virtual environment

python -m venv venv
source venv/Scripts/activate        # Windows (Git Bash)
# or
source venv/bin/activate            # Linux/macOS

3. Install dependencies

pip install -r requirements.txt

4. Configure the database

Create a .env file in the /backend/ directory:

DATABASE_URL=postgresql://username:password@localhost:5432/phytovigil
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=60
GEMINI_API_KEY=your_gemini_api_key_here

5. Launch the API

uvicorn app.main:app --reload

Access auto-generated documentation:

🧠 AI Module

The AI model is located in:

/app/ml/
├── model.h5         ← Trained TensorFlow model
├── class.json       ← ID to disease name mapping
└── diagnosis.py     ← Prediction code

🤖 Gemini Integration

The backend queries the Gemini API to provide users with detailed information and natural solutions for detected diseases, enhancing user experience with dynamic, tailored content.

📦 Project Structure

/backend
├── app/
│   ├── main.py
│   ├── database.py
│   ├── routes/
│   ├── models/
│   ├── schemas/
│   ├── crud/
│   ├── core/
│   ├── ml/
│   └── utils/
├── notebooks/
├── requirements.txt
├── .env
└── README.md

📝 License

This project is licensed under Apache 2.0 - see the LICENSE file.

👨‍💻 Author

Badie Bahida@badie16
2025 Internship – Project: 🌿 PhytoVigil