Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

Smart Plant Doctor

Smart Plant Doctor is an AI + IoT plant health platform that combines real-time environmental sensing from ESP32 devices with image-based disease detection and an AI plant care assistant.

Upgraded from the original Streamlit prototype to a full-stack React + FastAPI application with Supabase authentication, live WebSocket dashboards, and a production-ready API.

CA

EQdPcKnFDqZT5scQVrye58Uiu6aLSvZr7EVqpod6pump

Demo

Screenshots

Landing Page

Landing page

Plant Dashboard

Plant dashboard with live sensor metrics and charts

Disease Detection

AI disease detection with Rose Rust diagnosis

Plant Care Chat

AI plant care assistant chat

What's New (Major Upgrades)

FeatureBefore (v1)Now (v2)
FrontendStreamlitReact + TypeScript + Vite PWA
BackendSingle ingest.pyFastAPI with modular routers
AuthNoneSupabase (email + Google OAuth)
DatabaseSQLite onlyPostgreSQL (Supabase) or SQLite for local dev
DashboardBasic chartsLive metrics, charts, care recommendations, demo mode
Disease detectionStreamlit uploadDrag-and-drop UI with treatment cards + history
ChatGemma 4 AI assistant with optional plant context
Encyclopedia6 species with care guides, seasonal tips, diseases
DevicesBasic ESP32 ingestDevice onboarding, multi-pot support, WebSockets
CommunityDisease map (anonymized geohash reports)
Landing pageModern glassmorphism landing with feature showcase

Highlights

  • Real-time IoT dashboard — temperature, humidity, light, soil moisture, plant health score
  • AI disease detection — trained MobileNetV2 model, 29 classes, ~92.37% accuracy
  • Plant care chatbot — Gemma 4 powered assistant with live sensor context
  • Plant encyclopedia — care guides for Rose, Hibiscus, Aloe Vera, Money Plant, Chrysanthemum, Turmeric
  • Care journal — log watering, fertilizing, and repotting events
  • Device onboarding — register ESP32 sensors and stream live readings
  • Disease map — crowdsourced plant health reports

Architecture

ESP32 Sensors
  → POST /api/v1/ingest (device token)
  → FastAPI backend
  → PostgreSQL / SQLite
  → WebSocket → React dashboard

Leaf image upload
  → POST /api/v1/diagnose
  → MobileNetV2 (ai/inference.py)
  → Disease + confidence + treatment recommendations

Plant care question
  → POST /api/v1/chat
  → Gemma 4 (Google AI)
  → Contextual advice with sensor + diagnosis data

AI Model (Plant Disease Detection)

Model used

  • Backbone: MobileNetV2 (PyTorch)
  • Inference: SmartPlantDoctor in ai/inference.py
  • Input size: 224 × 224
  • Output: 29 plant disease / healthy classes
  • Validation accuracy: ~92.37%

Supported plants

PlantDisease classes
Rose8
Hibiscus4
Aloe Vera5
Money Plant4
Chrysanthemum3
Turmeric5

Exported artifacts

  • ai/exports/smart_plant_doctor_model.pth
  • ai/exports/class_mapping.json

Tech Stack

LayerTechnology
FrontendReact, TypeScript, Vite, Tailwind CSS, TanStack Query
BackendFastAPI, SQLAlchemy, Alembic
AuthSupabase (JWT + Google OAuth)
DatabasePostgreSQL (Supabase) / SQLite (local)
AI / MLPyTorch, MobileNetV2
LLM ChatGoogle Gemma 4 via Gemini API
IoTESP32, PlatformIO, WebSockets
MapsLeaflet (disease map)

Quick Start

Prerequisites

1. Clone

git clone https://github.com/GitHpriyanshu23/Smart-Plant-Doctor.git
cd Smart-Plant-Doctor

2. Backend

cd backend
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp ../.env.example .env   # configure DATABASE_URL, SUPABASE_*, GEMINI_API_KEY
uvicorn app.main:app --reload --port 8000

3. Frontend

cd frontend
cp .env.example .env      # add VITE_SUPABASE_URL + VITE_SUPABASE_ANON_KEY
npm install
npm run dev

Open http://localhost:5173 — landing page → sign in → dashboard.

Environment variables

Backend (backend/.env):

VariableDescription
DATABASE_URLPostgreSQL connection string or sqlite:////tmp/smart_plant_doctor.db
SUPABASE_URLYour Supabase project URL
SUPABASE_JWT_SECRETSupabase JWT secret (Settings → API)
GEMINI_API_KEYGoogle AI API key for chat
MODEL_PATHPath to smart_plant_doctor_model.pth

Frontend (frontend/.env):

VariableDescription
VITE_SUPABASE_URLSupabase project URL
VITE_SUPABASE_ANON_KEYSupabase anon key

ESP32 Firmware

Updated firmware in firmware/ with NVS token storage and multi-pot sensor support.

cd firmware
# Set WIFI_SSID, WIFI_PASSWORD in platformio.ini or src/main.cpp
pio run -t upload

Register your device in the app UI, then claim it with the device token.

API Endpoints

MethodEndpointDescription
GET/api/v1/plantsList user's plants
POST/api/v1/plantsAdd a plant
POST/api/v1/diagnoseUpload leaf image for disease detection
GET/api/v1/diagnose/historyDiagnosis history
POST/api/v1/chatAI plant care chat
GET/api/v1/encyclopediaSpecies care guides
POST/api/v1/ingestESP32 sensor data (device token)
WS/api/v1/ws/plants/{id}Live sensor feed

Deployment

ComponentPlatform
FrontendVercel
BackendRailway / Render
Database + AuthSupabase

Legacy Streamlit App

The original Streamlit prototype is preserved at app.py for reference. The new app is the recommended version.

Project Structure

smart-plant-doctor/
├── frontend/          # React PWA
├── backend/           # FastAPI API
├── ai/                # ML model + training
├── firmware/          # ESP32 PlatformIO project
├── docs/              # Setup guides + demo video
└── app.py             # Legacy Streamlit app

License

MIT

Author

Priyanshu

关于 About

Smart Plant Doctor is an AI + IoT plant health platform that streams realtime ESP32 sensor data to a Streamlit dashboard and uses a MobileNetV2-based model for plant disease detection with treatment recommendations.

语言 Languages

Python61.3%
TypeScript34.8%
C++3.5%
JavaScript0.2%
Dockerfile0.1%
HTML0.1%
CSS0.0%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
18
Total Commits
峰值: 8次/周
Less
More

核心贡献者 Contributors