-
-
Dashboard — real-time revenue, waste tracking, and environmental impact at a glance
-
AI Plan — RandomForest predicts demand, red items need urgent ordering with whole-number quantities
-
Smart Markdown — AI suggests 40% discount on spinach because 12.8 kg will expire without it
-
Voice Advisor — 10-language assistant with full access to AI forecasts and store data
-
Voice in action — agent recommends spinach discount with specific numbers from the AI plan
-
Profit Simulator — projects ₹6,302 annual savings and national-scale waste reduction impact
-
Results — ties to UN SDGs 2, 12, and 13 with real data, not hardcoded numbers
-
Sales — daily transaction log with undo, past date viewer, and revenue tracking
Inspiration
Around one-third of all food produced globally ends up wasted, roughly 931 million tonnes each year according to UNEP. But when most people think of food waste, they picture supermarkets or restaurants throwing out leftovers; the reality is that the biggest contributors are actually the millions of small grocery stores, the kirana stores in India, the tiendas across Latin America, the duka in East Africa, all run by individual owners who order stock based on gut feeling and years of habit rather than any kind of data.
I'm currently based in Japan, and I started noticing how the local vegetable vendors near me would toss produce at the end of each day. These are people who don't have spreadsheets or inventory management software. They can't afford enterprise systems — the cheapest inventory SaaS starts at $50/month, while a kirana store earns $10–20/day, and that gap is why this problem has never been solved for this audience — and in many cases, they have limited literacy that makes even basic apps difficult to navigate. That observation gave me an idea, and that idea was StockPilot. What if AI-powered demand forecasting could be accessible to a store owner, running entirely on their own machine with no subscriptions or cloud accounts, telling them exactly how much to order and when to discount, so less food ends up in the trash and more money stays in their pocket, and in their own language?
What it does
StockPilot is an offline-first AI inventory management app that helps small grocery stores reduce food waste by replacing gut-feel ordering with data-driven forecasting and smart pricing.
At its core is an AI demand forecasting engine. A RandomForest machine learning model trains on the store's own sales history, picking up on patterns like weekend demand spikes, mid-month dips, and day-of-week trends. For every item in the store, it predicts how much will sell tomorrow, and shows a confidence level along with an explanation of what factors shaped the prediction. When the store is new and sales data is limited, the model falls back to rolling averages, and for items with no history at all, it uses category-based priors so the owner still gets useful numbers from day one. In practice, the model reaches "medium" confidence within 10 days of sales data and "high" confidence after 90 days — at which point RandomForest predictions consistently outperform gut-feel ordering by the 19% MAE margin validated in testing. Over time, if the owner consistently adjusts the AI's recommendations, say they always order two extra trays of eggs because they know a nearby school buys from them on Fridays, the system learns from those adjustments and incorporates that local knowledge into future forecasts.
For stores running on Intel hardware, the ML pipeline is further optimized using Intel's scikit-learn extension (sklearnex), which delivered a 1.9× training speedup on CPU with zero code changes. The trained model is then exported to OpenVINO IR format, giving a 1.41× inference speedup — meaning the AI plan generates faster on the same low-cost hardware a small store owner actually owns. These were benchmarked on an Intel Core i5-1035G1.
On top of forecasting, StockPilot handles smart markdown pricing, and this is where the real waste prevention happens. When the system sees that a perishable item has more stock than the AI predicts it will sell before expiry, it calculates a specific discount percentage between 10 and 40 percent and tells the owner why, something like "estimated 12.8 kg of spinach will expire without markdown." This only triggers for perishables with a shelf life under 14 days; dry goods like rice and onions never get discount suggestions because overstocking them isn't a waste risk. The AI plan page displays every item color-coded by urgency: red for stock that will run out today, amber for items getting low within a couple days, and green for items that are fine, so the owner can see at a glance what needs their attention first. The environmental side runs in real time. Every kilogram of food waste is tracked and converted to CO₂ avoided using the WRAP 2016 factor of 2.5 kg CO₂e per kg, along with meals rescued and money saved. The dashboard, profit simulator, and results page all pull from the same live database, so none of this is hardcoded; it reflects the store's actual data. The profit simulator projects 30-day and annual savings so the owner can see concretely what better ordering would mean for their bottom line. Sales analytics give the owner visibility into their business that they never had before. Monthly revenue charts, daily transaction breakdowns, and trends across months help them see when demand peaks, which items bring in the most money, and where they're losing it.
The settings page lets the owner configure their store name, city, currency, and location coordinates. The latitude and longitude feed into the Open-Meteo weather API, so the AI plan can factor in spoilage risk from tomorrow's temperature and humidity when recommending order quantities for perishables. The entire core — forecasting, markdown suggestions, sales tracking, environmental impact — runs fully offline on SQLite with zero cloud dependency. A store owner in a village with unreliable internet can use the forecasting, dashboard, sales tracking, markdown suggestions, and environmental tracking without needing connectivity. For stores that additionally have internet access, StockPilot includes an optional voice advisor powered by ElevenLabs Conversational AI. This is about convenience and accessibility; the owner can ask "how much milk should I order for tomorrow?" or "should I discount spinach?" and get back answers with actual numbers from their store's data. It supports 10 languages including Hindi, Japanese, Spanish, and Arabic, which matters because many small store owners find speaking in their own language far easier than tapping through screens. The voice agent can also take real actions; saying "I sold 5 kg of tomatoes at 48 each" records the sale in the database, and saying "generate tomorrow's plan" runs the ML engine and reads back the top priorities. It has full access to the AI forecasts, urgency levels, and markdown suggestions for every item.
How we built it
The backend is FastAPI with SQLAlchemy and SQLite. Seven route modules handle items, sales, discards, planning, dashboard, settings, and voice context. SQLite was picked deliberately because the whole app needs to run on one machine with no internet; it gives us a real database with zero configuration.
The ML engine uses scikit-learn's RandomForestRegressor with features engineered from the sales data: day of week, weekend flag, day of month, week of year, and 7-day and 14-day rolling averages. The markdown algorithm compares current stock against forecast demand times shelf life, and only fires when the overstock ratio crosses 30 percent. Confidence levels are assigned based on how much historical data the model had to train on — 90 days gets "high" confidence, 10 days gets "medium," and new items with no data get "low" with a category prior as the prediction method.
The frontend is React with TypeScript, Vite, Tailwind CSS, and Framer Motion for animations. Nine pages, each with consistent styling and proper handling of loading, empty, and error states. The voice system uses ElevenLabs Conversational AI with four client tools registered. When a conversation starts, the app sends the full inventory as a contextual update, with AI forecasts, urgency flags, stock levels, and markdown suggestions for every single item. The client tools let the agent call the backend API directly to record sales, log waste, generate the plan, and look up item details, all triggered by the owner just talking.
Challenges we ran into
The markdown algorithm was suggesting discounts on rice, which has a 180-day shelf life and obviously doesn't need markdowns. The final version has a hard cutoff where anything with shelf life over 14 days gets zero markdown, and the discount percentage scales based on both the overstock ratio and how close the item is to expiry relative to its shelf life.
The ML model outputs continuous numbers like 7.7, but you can't buy 7.7 packs of milk. Every place where order quantities surface, the plan API, voice context, and frontend display, needed ceiling rounding to show whole numbers.
Historical waste tracking had a subtle bug. The data loading imports 90 days of discard events with past dates, but initially every discard decremented current stock regardless of date, which completely corrupted stock levels. The fix was a date parameter that only decrements stock for today's discards; historical ones get recorded for analytics but don't touch current inventory.
Getting the voice agent to answer with real specifics instead of vague responses required sending the complete per-item inventory as structured text, not just summaries. The plan generation tool also needed a 10-second response timeout since ML inference for 15 items takes a few seconds; the default 1-second timeout was causing every request to silently fail.
One architectural decision we were deliberate about: the voice advisor is the only component requiring internet. Every other feature — ML inference, markdown calculations, environmental tracking, the dashboard — runs entirely on-device. This was a conscious tradeoff to ensure the app remains useful in low-connectivity environments.
Accomplishments that we're proud of
The AI plan doesn't just say "buy 10 of this." It shows urgency levels in red, amber, and green, includes markdown suggestions only for perishables with clear reasoning, and gives explainable forecasts with confidence levels. Every number comes from the ML model trained on the store's own sales data, and it improves as more history accumulates.
The environmental tracker is fully live. When the owner logs a discard, it flows into waste calculations, updates CO₂ metrics, updates the profit simulator, and updates scale impact projections. Nothing is hardcoded anywhere.
The voice agent can take real actions, not just read back data. Saying "I sold 3 kg of tomatoes" actually writes to the database and updates the dashboard.
The entire core works offline. No cloud accounts, no API keys for core functionality, no monthly fees.
What we learned
Small stores waste food not because the owners don't care, but because they have no data to work with. Even a basic 7-day rolling average outperforms decades of gut-feel ordering, and layering a proper ML model on top with learned owner preferences makes the improvement meaningful enough to save real money.
ML accuracy matters less than explainability for building trust. A store owner doesn't care about a 19% MAE improvement. They care about understanding why the app says to buy 10 packs of milk, and whether that reasoning lines up with what they know about their customers. The Responsible AI principles built into StockPilot — transparency, human oversight, failure disclosure, and accountability — aren't compliance checkboxes. They're what makes a store owner trust an algorithm enough to act on it.
Building for users with limited literacy changes your assumptions about interfaces. Text and buttons aren't universal; for many store owners, speaking in their native language is the most natural way to interact with any technology.
What's next for StockPilot - AI Demand Forecasting for Zero-Waste Stores
Right now the biggest friction point is that sales have to be logged manually, either through the app or by voice. It works, but busy store owners will forget during rush hours. The most important next step is connecting directly to billing systems or adding receipt scanning, so every sale gets captured automatically the moment a transaction happens. Once that pipeline exists, the AI model gets better data with zero effort from the owner, and the whole experience becomes seamless.
Beyond that, the immediate next step before wider rollout is a validation session I'm conducting with local vegetable vendors in Japan — observing how they interact with the forecasting and markdown features in a real sales environment and measuring whether AI-recommended order quantities reduce end-of-day discards. Other planned work includes integrating wholesale market pricing so the app can suggest stocking up when supplier prices drop, building community-level demand sharing where nearby stores contribute anonymized sales signals to improve forecasts for seasonal items, and adding an SMS fallback for areas where owners don't have smartphones.
Built With
- elevenlabs-conversational-ai
- fastapi
- framer-motion
- python
- react
- recharts
- scikit-learn
- sqlalchemy
- sqlite
- tailwind-css
- typescript
- vite
Log in or sign up for Devpost to join the conversation.