Uzhavan Bazzar (உழவன் சந்தை)
An AI that looks at every side of the crop, so the farmer gets a fair price and the buyer gets the truth.
Live now: https://uzhavan-bazzar.duckdns.org
Inspiration
A farmer in Tamil Nadu picks 25 kg of tomatoes at dawn and carries them to a middleman. The middleman glances at the crate, decides the grade by eye, names the price, and keeps the margin. The farmer never sees the live mandi rate. The buyer can’t tell if the bottom of the crate is rotten, so they distrust everything.
Three things are broken in that one transaction:
Trust: nobody can verify quality. Price: the farmer negotiates blind. Access: most apps assume English and a tech-savvy user.
The grower is the one who has done the work, and the middleman is the one who profits. We built Uzhavan Bazzar (“Farmers’ Market” in Tamil) to put the farmer back in charge: AI does the grading, the government mandi price sets the fair range, and the buyer deals directly with the farmer in their own language.
What it does
Uzhavan Bazzar is an AI-powered, direct-from-farmer marketplace.
AI grading from four photos. The farmer takes four photos (front, side, opposite, close-up). A custom YOLO detector identifies the crop and a MobileNetV3-Large network grades its freshness. The result is a 0 to 100 score and a Grade A, B or C. Fair price, automatically. The app pulls the live APMC mandi benchmark and suggests a price band for the grade. For a mandi price of ₹55/kg, Grade A is ₹50 to ₹55 and Grade B is ₹45 to ₹52. Grade C is below ₹45. The farmer’s batch revenue updates as the quantity changes, and the farmer can still override the price. A marketplace buyers can trust. Buyers see the four photos, the quality score, and the mandi comparison before they order. Livestock trading. Dairy cows, goats, country hens, fresh milk and organic eggs, with breed, milk yield, age and vaccination history. Delivery that picks itself. Orders within 50 km go by direct local transport. Anything farther goes by India Post Parcel. Buyers track it live on a Leaflet and OpenStreetMap map. Built for rural users. Full Tamil and English, with every screen translated.
It’s also deployed and live on an AWS host with SSL, with a public API and a health endpoint that reports GPU and model status.
How we built it
Stack: React, Vite, TypeScript and Tailwind on the frontend. FastAPI and PyTorch (CUDA, FP16) on the backend. Firebase for auth and data. Nginx with Let’s Encrypt in production.
Stage 1: Detection and filtering. A custom YOLO model recognizes the crop. A YOLOv8n person detector and a YuNet face detector keep hands, faces and clothing from affecting the grade.
Stage 2: Quality grading. A dual-head MobileNetV3-Large predicts both fresh vs. rotten and a continuous defect score.
Stage 3: Conservative 4-view fusion. We designed the fusion so a seller cannot hide a bad side. The worst photo counts heavily:
$$S_{\text{final}} = 0.40\,\bar{S} + 0.35\,S_{\min} + 0.15\,C_{\text{qual}} + 0.10\,C_{\text{consist}} - P_{\text{rot}}$$
$\bar S$ is the average view score, $S_{\min}$ is the worst view, $C_{\text{qual}}$ is model confidence, $C_{\text{consist}}$ is agreement across angles, and $P_{\text{rot}}$ is a penalty if any single angle shows mold or rot. That penalty pushes the lot into Grade C to protect the buyer.
Stage 4: Fair pricing. With mandi benchmark $M$ in ₹/kg:
$$A:\ [M-5,\ M],\qquad B:\ [M-10,\ M-3],\qquad C:\ <M-10$$
Stage 5: Logistics. The Haversine formula gives the farm-to-buyer distance $d$:
$$d = 2R\arcsin!\left(\sqrt{\sin^2!\tfrac{\Delta\phi}{2}+\cos\phi_1\cos\phi_2\sin^2!\tfrac{\Delta\lambda}{2}}\right)$$
If $d \le 50$ km, the order goes direct and local. If $d > 50$ km, it goes through India Post.
Quality and testing. The quality model was evaluated on 700 balanced images across 14 crops. We also wrote a 6-part automated acceptance suite covering grading, pricing and 4-view fusion, plus a Swagger console and a live health endpoint.
Challenges we ran into The “hide the bad side” problem. Single-photo grading is easy to cheat. Four angles with a worst-case-weighted score solved it. False detections. The model kept “finding” produce on faces, hands and cluttered backgrounds. Stacking a person detector and a neural face detector in front of grading fixed it. GPU to production. Running a two-model CUDA pipeline reliably on a cloud server, behind Nginx with SSL, took real debugging of paths, drivers and proxies. Real prices, not hardcoded ones. Tying pricing to a live mandi registry meant handling missing data and different commodity names. Rural-first design. Translating the full interface, including errors and toasts, into Tamil. Accomplishments that we’re proud of 99.43% classification accuracy across 14 crops, with 99.70% rotten-produce recall (349 of 350 rotten samples caught) and 100% fresh precision, so no rotten crop was graded fresh in testing. AUC-ROC of 0.9987, with latency under 45 ms per image on GPU. An anti-fraud grading design where the worst photo counts the most. A fully deployed, public product, not a prototype: live site, live API docs, live health telemetry. One platform that covers produce, livestock, logistics and tracking, in two languages. What we learned Trust is a feature you can engineer. Penalizing the worst angle matters more to buyers than a high average. Simple filters beat bigger models. Cheap checks before the network removed errors that more data alone wouldn’t. Deploying is half the project. A model that works on a laptop is not a product until it survives a server. Language is access. An app a farmer can read in Tamil is an app a farmer will actually use. What’s next for UZHAVAN BAZZAR Beyond Tamil Nadu: more states’ mandis and more languages, starting with Hindi, Telugu and Kannada. More crops: expand past 14 commodities to grains, spices and regional varieties. Domestic payments: Razorpay for UPI, cards and net banking, plus PayPal for export buyers. Offline-first mode and a lighter app for weak rural networks. A faster, more animated buyer portal in the spirit of top Indian shopping apps. Farmer cooperatives: bulk listings and shared logistics for small growers.
Our goal is simple: a farmer anywhere in India should be able to take four photos and get a fair price.
Built with: React · Vite · TypeScript · Tailwind CSS · FastAPI · PyTorch (CUDA) · YOLOv8 · MobileNetV3 · OpenCV YuNet · Firebase · Leaflet / OpenStreetMap · APMC Mandi pricing · Nginx + Let's Encrypt · AWS
Try it: https://uzhavan-bazzar.duckdns.org · API docs at /docs · Code: github.com/Gopi45-gk/uzhavan_bazzar
Built With
- agmarknet
- amazon-web-services
- computer-vision
- cuda
- deep-learning
- fastapi
- firebase
- firestore
- framer-motion
- leaflet.js
- lets-encrypt
- mobilenetv3
- nginx
- opencv
- openstreetmap
- paypal
- python
- pytorch
- react
- tailwindcss
- typescript
- vite
- web-speech-api
- yolov8