How phanna125/cornapp works
Corn Leaf Doctor is an offline-first Telegram Mini App for identifying five corn-leaf conditions and presenting confidence scores and treatment advice. Farmers select or capture leaf images on Home; App orchestrates preprocessing and local ONNX/WASM inference, then saves results and displays analysis and diagnosis screens. The app also supports batch scans, sample leaves, recent-scan history, Telegram sharing and native controls, plus an included bot for launching the Mini App. README describes these capabilities; some component internals and the bot implementation were not excerpted.
Main entry points: App.tsx App orchestrator · HomeScreen.tsx Home scanner · inference.ts Inference engine · telegram.ts Telegram helpers
Components 17
Scan workflow
- App orchestrator
src/App.tsx - Home scanner
src/components/HomeScreen.tsx - Analysis screen
src/components/AnalyzingScreen.tsx - Diagnosis screen
src/components/DiagnosisScreen.tsx - Status and mode
src/components/TopBar.tsx - React entry
src/main.tsx
On-device diagnosis
- Inference engine
src/utils/inference.ts - Image preprocessing
src/utils/imagePreprocessing.ts - Corn ONNX model
public/models/mobilenetv3_corn_single.onnx
Advice and history
- Disease catalog
src/data/diseases.ts - UI translations
src/data/translations.ts - Scan history
src/utils/history.ts - Browser storage
Telegram integration
- Telegram helpers
src/utils/telegram.ts - Telegram platform
- Launch bot
bot/bot.py
Other components
- Farmer
Connections 23
- Farmer → Home scanner: selects images
README.md - React entry → App orchestrator: renders
src/main.tsx - App orchestrator → Home scanner: renders
src/App.tsx - App orchestrator → Analysis screen: renders
src/App.tsx - App orchestrator → Diagnosis screen: renders
src/App.tsx - App orchestrator → Status and mode: renders
src/App.tsx - Home scanner → App orchestrator: submits images
src/App.tsx - App orchestrator → Inference engine: runs diagnosis
src/App.tsx - Inference engine → Image preprocessing: preprocesses images
src/utils/inference.ts - Inference engine → Corn ONNX model: loads model
README.md - Inference engine → Disease catalog: maps classes
src/utils/inference.ts - App orchestrator → Scan history: saves scans
src/App.tsx - Home scanner → Scan history: loads demo scans
src/components/HomeScreen.tsx - Scan history → Browser storage: reads and writes
src/utils/history.ts - Home scanner → Disease catalog: builds sample scans
src/components/HomeScreen.tsx - App orchestrator → Telegram helpers: initializes controls
src/App.tsx - Status and mode → Telegram helpers: triggers haptics
src/components/TopBar.tsx - Diagnosis screen → Telegram helpers: shares results
src/components/DiagnosisScreen.tsx - Telegram helpers → Telegram platform: uses WebApp API
src/utils/telegram.ts - Launch bot → Telegram platform: configures launch
README.md - Home scanner → UI translations: displays copy
src/components/HomeScreen.tsx - Diagnosis screen → UI translations: displays copy
src/components/DiagnosisScreen.tsx - App orchestrator → UI translations: configures button
src/App.tsx