Kavita's school had a "Student Innovation for India" competition. The theme: use technology to solve a problem you see in your community. While her classmates thought of apps for ordering food faster, Kavita thought bigger. Her uncle is a soybean farmer in Vidisha district who loses 20–30% of his crop every year to diseases he can't identify early. Her grandmother lives 40 km from the nearest hospital.
"AI doesn't just make apps faster," Kavita wrote in her project proposal. "It can give a poor farmer the same advisory service as a large agricultural company. It can give a rural patient access to preliminary diagnosis that was only possible in big cities. That's the kind of AI I want to build." She won first place. This lesson explores the four domains where student-built AI can create the most impact in India.
# Soybean Crop Disease Classifier — Kavita's project
# Uses: Transfer Learning (MobileNetV2) + Streamlit + Streamlit Cloud
# ── Step 1: Data — PlantVillage dataset on Kaggle ──
# https://www.kaggle.com/datasets/abdallahalidev/plantvillage-dataset
# Folder structure: data/train/Soybean_Bacterial_Blight/
# data/train/Soybean_Frogeye_Leaf_Spot/
# data/train/Soybean_Healthy/
import tensorflow as tf
from tensorflow.keras.applications import MobileNetV2
from tensorflow.keras.layers import Dense, GlobalAveragePooling2D, Dropout
from tensorflow.keras.models import Model
from tensorflow.keras.preprocessing.image import ImageDataGenerator
CLASSES = ["Bacterial Blight", "Frogeye Leaf Spot", "Healthy"]
IMG_SIZE = 224
BATCH = 32
EPOCHS = 10
# Data generators with augmentation
train_gen = ImageDataGenerator(
rescale=1./255, rotation_range=20, horizontal_flip=True,
zoom_range=0.15, validation_split=0.2
)
train_data = train_gen.flow_from_directory(
"data/", target_size=(IMG_SIZE, IMG_SIZE),
batch_size=BATCH, subset='training', class_mode='categorical'
)
val_data = train_gen.flow_from_directory(
"data/", target_size=(IMG_SIZE, IMG_SIZE),
batch_size=BATCH, subset='validation', class_mode='categorical'
)
# Transfer learning: MobileNetV2 base + custom head
base = MobileNetV2(input_shape=(IMG_SIZE, IMG_SIZE, 3), include_top=False, weights='imagenet')
base.trainable = False
x = base.output
x = GlobalAveragePooling2D()(x)
x = Dropout(0.3)(x)
output = Dense(len(CLASSES), activation='softmax')(x)
model = Model(inputs=base.input, outputs=output)
model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
# Train
history = model.fit(train_data, validation_data=val_data, epochs=EPOCHS)
model.save("soybean_model.h5")
print(f"Val accuracy: {max(history.history['val_accuracy']):.3f}")
# ── Step 2: Streamlit app (save as app.py) ──
# streamlit run app.py
APP_CODE = '''
import streamlit as st, numpy as np
from PIL import Image
import tensorflow as tf
CLASSES = ["Bacterial Blight", "Frogeye Leaf Spot", "Healthy"]
TREATMENTS = {
"Bacterial Blight": "Copper-based bactericide. Remove infected leaves. Avoid overhead irrigation.",
"Frogeye Leaf Spot": "Thiophanate-methyl fungicide. Plant resistant varieties next season.",
"Healthy": "Crop is healthy! Monitor weekly for early signs."
}
@st.cache_resource
def load_model():
return tf.keras.models.load_model("soybean_model.h5")
st.title("🌱 Soybean Disease Detector")
st.markdown("Upload a soybean leaf photo to identify disease.")
model = load_model()
uploaded = st.file_uploader("Upload leaf image", type=["jpg","jpeg","png"])
if uploaded:
img = Image.open(uploaded).convert("RGB")
st.image(img, use_container_width=True)
arr = np.expand_dims(np.array(img.resize((224,224)))/255.0, 0)
pred = model.predict(arr)[0]
cls = CLASSES[np.argmax(pred)]
conf = pred.max()
st.success(f"**{cls}** ({conf*100:.1f}% confidence)")
st.info(TREATMENTS[cls])
'''
with open("app.py", "w") as f:
f.write(APP_CODE)
print("app.py written — run: streamlit run app.py")- ✅ Is there a real person who has this problem? Can you talk to them? (Farmer, patient, teacher, small business owner)
- ✅ Is there public data? Check: Kaggle, data.gov.in, AI4Bharat, iNaturalist, UDISE+, RBI open data
- ✅ Does your output have a clear action? "Disease X — use Y treatment" is better than just "Probability: 0.73"
- ✅ Can you build a v1 in 2 weeks? Start simpler than you think. A working simple model beats a theoretically perfect one
- ✅ How will you handle wrong predictions? Always show confidence. For healthcare/agriculture, always say "Verify with an expert"
- ✅ Who gives feedback? Real users who test your app give 10× more learning than any evaluation metric