Inspiration India loses an estimated 30–40% of its fresh produce to spoilage during transit — not because farmers grow bad crops, but because the roads, weather, and timing aren't accounted for when a truck leaves the mandi. A tomato that survives 800 km in October can perish on the same route in May. We built KrishiMarg because the problem isn't just logistics — it's that logistics tools weren't built with Indian agriculture in mind. No crop profiles, no regional weather awareness, no voice output for a transport manager who speaks Hindi or Tamil. We wanted to fix that.

What It Does KrishiMarg is a spatio-temporal route risk analyzer for agricultural logistics. Given an origin, a destination, and the crop being transported, it:

Fetches all viable driving routes via OSRM Samples real-time weather (temperature, humidity) every 10 km along each route, adjusted for the estimated arrival time at each waypoint Computes a spoilage risk score for each route using a regression-trained cost function built on crop-specific safe temperature and humidity profiles Recommends the optimal route via Sarvam AI, with the explanation delivered in text and voice across 8 Indian languages — Hindi, Tamil, Telugu, Kannada, Marathi, Bengali, Gujarati, and English

The result: a transport manager anywhere in India can understand which route keeps their crop safest, in the language they actually speak.

How We Built It The stack is end-to-end on Databricks, with a Streamlit frontend. Data & ML (Databricks): We curated storage profiles for 20 Indian crops — safe temperature ranges, humidity tolerances, and transit windows — stored as a Delta table. A spoilage dataset was used to train a regression model (Random Forest vs. Gradient Boosting, best selected by R²) on delta features: how far each route's weather deviates from a crop's safe envelope. The winning model's feature importances became the coefficients of our deployed cost function. Routing & Weather: OSRM provides alternative driving routes with full geometry. We walk each route's coordinates, sample a waypoint every 10 km, and query Open-Meteo's forecast API for temperature and humidity at the estimated arrival time — so a 14-hour route doesn't assume the same weather the whole way. AI Layer (Sarvam): Route data is packaged into a structured prompt and passed to sarvam-m, which generates a natural-language recommendation paragraph. That text is translated using Sarvam's translation API and converted to audio via bulbul:v3 TTS — all in the user's chosen language. Map: Folium renders colour-coded route overlays with full weather and risk tooltips directly in the Streamlit UI.

Challenges We Ran Into Waypoint weather at scale: Open-Meteo supports batch lat/lon queries, but aligning arrival-time offsets to hourly forecast slots across 20+ waypoints per route took careful indexing — off-by-one errors here meant weather data from the wrong hour entirely. Crop profile matching: Real-world datasets use inconsistent crop names ("tomato", "Tomato", "cherry tomato"). We had to normalize aggressively and gracefully drop unmatched rows without silently corrupting the training set. Sarvam TTS chunking: The bulbul:v3 model has a character limit per request. Long multilingual recommendations had to be split on sentence boundaries, converted in chunks, and stitched back into a single audio stream — with care not to split mid-word or mid-number. Keeping the UI responsive: Running OSRM, weather batch calls, and risk scoring sequentially for 3–4 routes could stall the UI. Streamlit's caching and spinner states helped, but the ordering of API calls needed deliberate sequencing.

Accomplishments That We're Proud Of The 10 km waypoint weather model is something we're genuinely pleased with — it moves beyond treating a route as a single average temperature and instead reflects the real thermal journey a crop takes. A route that passes through the Deccan plateau at noon looks very different from one that skirts the coast at dusk, and our model captures that. We're also proud of the multilingual voice output being a first-class feature, not an afterthought. The entire recommendation pipeline — analysis, language model, translation, speech — runs end-to-end in under 15 seconds for any of the 8 supported languages.

What We Learned Building for Indian agriculture means respecting that the end user is rarely the developer. A risk score of 47.3 means nothing to a transport manager in Nashik — but "Route 2 risks spoiling your onions due to high humidity near Pune" in Marathi does. Framing the AI output as a spoken advisory rather than a dashboard metric changed how we thought about the whole product. We also learned that crop-relative features (delta from safe range) outperform raw weather values in the regression — the model doesn't care that it's 38°C, it cares that it's 12°C above what mangoes can safely handle.

What's Next for KrishiMarg

Live traffic integration — incorporate road congestion data so time estimates (and therefore arrival-time weather) are more accurate Cold chain flagging — detect routes where refrigerated transport becomes necessary and surface that as an explicit recommendation More crops — expand beyond 20 profiles to cover the full diversity of Indian horticulture, including region-specific varieties Driver app — a lightweight mobile interface with turn-by-turn risk alerts in the driver's language as conditions change en route Mandi integration — pull real-time arrival price data so the route recommendation balances spoilage risk against market timing

Built With

Share this project:

Updates