Inspiration

“What if farmers could diagnose crop diseases as easily as taking a selfie?”

Across many developing regions, farmers lose up to 40% of their crops due to preventable plant diseases. For smallholder farmers, this is not just an agricultural issue it directly affects food security, income, and survival.

This challenge is closely tied to:

  • SDG 1: No Poverty
  • SDG 2: Zero Hunger

We were inspired to bridge the gap between AI innovation and real-world agricultural impact by transforming smartphones into accessible plant health tools.


What it does

Leaf Labs is an AI-powered web application that enables users to:

  • Capture or upload a leaf image
  • Detect plant diseases instantly
  • Receive treatment recommendations
  • Access plant health knowledge

To improve reliability, the system uses a hybrid AI approach. When the model confidence is low ( P(c \mid x) < 0.75 ), a fallback AI model is triggered to validate the prediction.


How we built it

We built Leaf Labs using a modern full-stack architecture:

Frontend

  • Next.js 14
  • Tailwind CSS
  • shadcn/ui

AI System

  • Fine-tuned MobileNet model
  • ONNX Runtime Web for browser-based inference
  • Gemini Vision API for fallback validation

Backend and Infrastructure

  • Supabase (Authentication, Database, Storage, Edge Functions)
  • PostgreSQL
  • Vercel for deployment

The prediction system combines both models using a weighted approach:

$$ Final\ Prediction = \arg\max_c \big( \alpha \cdot P_{onnx}(c \mid x) + (1 - \alpha) \cdot P_{gemini}(c \mid x) \big) $$


Challenges we ran into

Building Leaf Labs came with several challenges:

  • Optimizing AI models for fast browser execution
  • Handling poor lighting and low-quality camera inputs
  • Balancing speed with prediction accuracy
  • Designing a reliable fallback system
  • Creating a simple interface for non-technical users

These challenges pushed us to focus on accessibility, performance, and usability.


Accomplishments that we're proud of

  • Built a real-time AI-powered plant disease detection system
  • Achieved fast in-browser inference using ONNX Runtime Web
  • Implemented a hybrid AI validation pipeline
  • Designed a solution that works in low-resource environments
  • Aligned the project with global sustainability goals

Most importantly, we created a solution with real-world impact potential.


What we learned

Through this project, we learned that:

  • Lightweight AI can still be powerful
  • Edge and browser-based inference increase accessibility
  • Simplicity improves usability and adoption
  • Technology must be human-centered to create real impact

What's next for Leaf Labs

We plan to expand Leaf Labs into a broader agricultural intelligence platform:

  • Support more crops and diseases
  • Add multilingual capabilities
  • Improve offline functionality
  • Partner with NGOs and agricultural institutions
  • Introduce predictive analytics for early disease prevention

Our long-term vision:

$$ Healthy\ Crops \Rightarrow Higher\ Yields \Rightarrow Reduced\ Poverty + Zero\ Hunger $$

Leaf Labs is more than a tool; it is a step toward a future where technology empowers every farmer to grow with confidence.

Built With

Share this project:

Updates