How d-nithinteja/plant-aid works
Plant-Aid is a plant-disease diagnosis and treatment-advisory application, with a React interface in this tree and a FastAPI backend. The principal workflow accepts a plant image, runs disease inference, returns a confidence-qualified diagnosis and remedies, and lets the user explicitly save and later review history. Separate capabilities include account/OTP authentication, disease guidance, administration, and model training and evaluation. The README documents the diagnostic stages and explicit history-save action; source-index references support many internal links. Unsampled implementation details and some UI-to-API wiring are not asserted.
Main entry points: main.py FastAPI application · App.tsx Web application · database.py SQL database · inference.py Inference routes
Components 27
User interface
- Web application
frontend/src/App.tsx - Sign-in and OTP
frontend/src/context/AuthContext.tsx - Scan interface
frontend/src/pages/ScanPage.tsx - Diagnosis history
frontend/src/pages/HistoryPage.tsx - Disease guide
frontend/src/pages/DiseaseGuidePage.tsx - Admin console
frontend/src/pages/AdminPage.tsx
API workflows
- FastAPI application
backend/app/main.py - Authentication routes
backend/app/routers/auth.py - Inference routes
backend/app/routers/inference.py - History routes
backend/app/routers/history.py - Remedy routes
backend/app/routers/remedy.py - Admin routes
backend/app/routers/admin.py - JWT and access control
backend/app/security.py - OTP delivery
backend/app/services/otp_service.py
Diagnosis services
- Inference engine
backend/app/services/ml_engine.py - Disease catalog lookup
backend/app/services/disease_lookup.py
Application data
- Image storage
backend/app/services/storage.py - SQL database
backend/app/database.py - Domain records
backend/app/models.py
Model lifecycle
- Disease class catalog
backend/ml/ml_config.py - Dataset loading
backend/ml/dataset.py - Classifier architecture
backend/ml/model.py - Model training
backend/ml/train.py - Model evaluation
backend/ml/evaluate.py - Model export
backend/ml/export.py - Grad-CAM tooling
backend/ml/gradcam.py
Other components
- Farmer or agronomist
Connections 39
- Farmer or agronomist → Web application: uses
- Web application → Sign-in and OTP: provides
frontend/src/App.tsx - Web application → Scan interface: routes to
frontend/src/App.tsx - Web application → Diagnosis history: routes to
frontend/src/App.tsx - Web application → Disease guide: routes to
frontend/src/App.tsx - Web application → Admin console: routes to
frontend/src/App.tsx - Sign-in and OTP → FastAPI application: calls API
- Scan interface → FastAPI application: calls API
- FastAPI application → Authentication routes: registers
backend/app/main.py - FastAPI application → Inference routes: registers
backend/app/main.py - FastAPI application → History routes: registers
backend/app/main.py - FastAPI application → Remedy routes: registers
backend/app/main.py - FastAPI application → Admin routes: registers
backend/app/main.py - Authentication routes → JWT and access control: imports
backend/app/routers/auth.py - Authentication routes → OTP delivery: uses
backend/app/routers/auth.py - Inference routes → Inference engine: runs inference
backend/app/routers/inference.py - Inference routes → Image storage: stores image
backend/app/routers/inference.py - Inference routes → Disease catalog lookup: looks up remedies
- History routes → Image storage: uses media storage
backend/app/routers/history.py - History routes → Disease catalog lookup: uses lookup
backend/app/routers/history.py - Remedy routes → Disease catalog lookup: uses lookup
backend/app/routers/remedy.py - Admin routes → Image storage: uses media storage
backend/app/routers/admin.py - Admin routes → Disease catalog lookup: uses lookup
backend/app/routers/admin.py - Authentication routes → SQL database: queries data
backend/app/routers/auth.py - Inference routes → SQL database: queries data
backend/app/routers/inference.py - History routes → SQL database: queries data
backend/app/routers/history.py - Remedy routes → SQL database: queries data
backend/app/routers/remedy.py - Admin routes → SQL database: queries data
backend/app/routers/admin.py - SQL database → Domain records: maps records
backend/app/database.py - Inference engine → Disease class catalog: loads classes
backend/app/services/ml_engine.py - Model training → Dataset loading: loads samples
backend/ml/train.py - Model training → Classifier architecture: builds classifier
backend/ml/train.py - Model training → Disease class catalog: uses class list
backend/ml/train.py - Model evaluation → Dataset loading: uses dataset
backend/ml/evaluate.py - Model evaluation → Classifier architecture: uses classifier
backend/ml/evaluate.py - Model export → Dataset loading: uses dataset
backend/ml/export.py - Model export → Classifier architecture: uses classifier
backend/ml/export.py - Model export → Grad-CAM tooling: uses Grad-CAM
backend/ml/export.py - Model export → Disease class catalog: exports labels
backend/ml/export.py