I Built an Offline AI Crop Disease Identifier for Smart India Hackathon

Published: (June 10, 2026 at 04:02 PM EDT)
2 min read
Source: Dev.to

Source: Dev.to

๐ŸŒ Live demo: https://dev48v.infy.uk/solve/day3-crop-disease.html

Day 3 of SolveFromZero โ€” pick a real hackathon brief, ship a working solution. Todayโ€™s problem is a perennial Smart India Hackathon: 35% of Indian crop losses come from undiagnosed disease, and the village ag-extension officer canโ€™t visit every farm.

The fix: a phone app where the farmer photographs a sick leaf, AI returns the disease + a remedy in Hindi or Marathi. Runs fully offline on a โ‚น6,000 Android phone.

The hard constraints

Hardware โ‚น6,000 Android phone, 2 GB RAM

Network Patchy 2G in rural areas

Model size Must fit in { const img = new Image(); img.src = URL.createObjectURL(e.target.files[0]); await img.decode();

const tensor = tf.browser.fromPixels(img) .resizeBilinear([224, 224]) .toFloat().div(255).expandDims();

const probs = await model.predict(tensor).data(); const top = probs.indexOf(Math.max(โ€ฆprobs));

console.log(CLASSES[top], probs[top]); };


    Enter fullscreen mode
    

    Exit fullscreen mode
    

  
  
  Stage 5 โ€” Remedy lookup + Hindi voice

const REMEDIES = { โ€œtomato_late_blightโ€: { treatment: โ€œSpray 2g/L Mancozeb every 7 days for 3 weeks.โ€, hindi: โ€œเคฎเฅˆเคจเค•เฅ‹เคœเคผเฅ‡เคฌ 2 เค—เฅเคฐเคพเคฎ/เคฒเฅ€เคŸเคฐ เคชเคพเคจเฅ€ เคฎเฅ‡เค‚ เคฎเคฟเคฒเคพเค•เคฐ 7 เคฆเคฟเคจ เคฎเฅ‡เค‚ เค›เคฟเคกเคผเค•เคพเคต เค•เคฐเฅ‡เค‚เฅคโ€ }, // โ€ฆ 38 entries };

const r = REMEDIES[CLASSES[top]];

const utter = new SpeechSynthesisUtterance(r.hindi); utter.lang = โ€œhi-INโ€; speechSynthesis.speak(utter);


    Enter fullscreen mode
    

    Exit fullscreen mode
    

Many farmers can't read. Voice output is the difference between "interesting demo" and "actually deployable tool."

  
  
  Offline-first PWA (the critical detail)

Rural villages have spotty 2G. App must work without network after first install:

// service-worker.js self.addEventListener(โ€œinstallโ€, e => { e.waitUntil( caches.open(โ€œcrop-v1โ€).then(cache => cache.addAll([ โ€/โ€, โ€œ/index.htmlโ€, โ€œ/app.jsโ€, โ€œ/model/model.jsonโ€, โ€œ/model/weights.binโ€ // 3.5 MB ]) ) ); });


    Enter fullscreen mode
    

    Exit fullscreen mode
    

After the first visit, the app + model are cached. Works in airplane mode. This is what makes the app **actually deployable**.

  
  
  Try it now

3-tier page with simulated 4-leaf classifier + 9-step understanding:

**[https://dev48v.infy.uk/solve/day3-crop-disease.html](https://dev48v.infy.uk/solve/day3-crop-disease.html)**

  
  
  What this unlocks

Same pipeline (small CNN + lookup table + voice) works for:

Problem
Model swap

Cattle disease ID
PlantDoc-style cattle dataset

Weed identification
DeepWeeds dataset

Soil-color โ†’ nutrient deficiency
Custom dataset + simple classifier

Insect pest identification
IP102 dataset

The CNN + offline PWA + multilingual voice = the template for **any** rural-village AI deployment.

  
  
  What's next in SolveFromZero

Day 4: **GitHub repo health scorer** (Devpost). Paste a GitHub URL โ†’ get a health score based on stars, recent commits, issue/PR ratios.

๐ŸŒ All problems: [https://dev48v.infy.uk/solvefromzero.php](https://dev48v.infy.uk/solvefromzero.php)
0 views
Back to Blog

Related posts

Read more ยป