How khnychenkoav/plantdiseasedetector works
Project Type and Purpose
• This is a full-stack web application with an integrated machine-learning inference component.
• Purpose: allow users to upload plant images, detect diseases via ML, render results and garden maps, and store data.
File Structure
• Top-level directories:
• frontend/ – React app (UI components, webpack).
• backend/ – FastAPI (or Django) service (routes, models, schemas).
• ml_model/ – Training and inference code; ONNX model.
• docker/ – Dockerfiles and Compose orchestration.
• docs/ – API and architecture specs.
• Notice MVC-style separation in backend (models, schemas, routes).
• Docker Compose defines at least three containers: frontend, backend, and likely a Postgres DB (plus MinIO/S3).
README for Stack and Runtime Insights
• Frontend runs on Node.js at port 3000.
• Backend (FastAPI) runs on Python at port 8000.
• ML inference uses the ONNX model (inference/predict.py).
• Data persists in PostgreSQL.
• Images stored in S3/MinIO.
• All services orchestrated via Docker Compose.
Main Components
a. Frontend UI (React)
b. API Layer (Backend FastAPI)
c. ML Inference Module
d. Database (PostgreSQL)
e. Object Storage (S3 or MinIO)
f. (Optional) External Camera or Cron‐job for Automated Uploads
g. Docker Compose / Container Boundary
Relationships & Data Flow
• User → Frontend: uploads image via UploadForm.js
• Frontend → Backend (/image_analysis endpoint): HTTP POST
• Backend → ML Inference Module: function call or internal HTTP/gRPC to predict.py
• Backend → Database: read/write users, gardens, disease records
• Backend → Object Storage: save raw images, fetch URLs
• Backend → Frontend: JSON response containing disease predictions & recommendations
• Frontend → Backend (/recommendations & /garden endpoints) for additional data
• (Optional) External Camera → Backend: via a scheduled job or API endpoint
Architectural Patterns
• Containerized microservices via Docker Compose.
• Separation of concerns: UI, API, ML, Data stores.
• Model‐View‐Controller style in backend (models/schemas/routes).
• Asynchronous tasks can be added (e.g., Celery) for heavy ML jobs.
Relevant Technologies & Frameworks
• React (frontend), Webpack
• FastAPI (Python backend), Pydantic schemas
• ONNX Runtime (inference)
• PostgreSQL
• S3/MinIO for object storage
• Docker & docker-compose