How shrey-14/smart-resto works
Project Type and Purpose
• SmartResto is a full-stack, AI-driven kitchen management web application.
• Frontend: React/TypeScript SPA for interactive dashboards, uploads, and real-time views.
• Backend: FastAPI service orchestrating ML pipelines for vision, forecasting, waste prediction, and menu optimization.
• Purpose: reduce food waste and improve kitchen efficiency via computer vision, forecasting, and generative AI.
High-Level Components
a. Frontend (React/TS)
• UI layers: Layout (Navbar, Sidebar), Pages (Index, Inventory, NotFound), Feature Components (Inventory, Waste, Sales, Cost tools).
• Services: HTTP client (src/services/api.ts) for REST calls to backend.
b. Backend (FastAPI)
• API layer (api.py, main.py) – exposes endpoints for vision, forecasting, spoilage, menu optimization.
• ML modules:
– Vision Analysis (YOLOv8, waste_heatmap, classification)
– Inventory Tracking (stock_detection, live inventory)
– Food Spoilage Detection (LLaMA inference)
– Menu Optimization (cost_optimizer, recipe_generator, recipe_recommender)
• Config & Storage: config.yaml, output CSVs, local data folders.
• Entrypoint script (run_api.sh).
c. Data Stores
• Model artifacts (YOLO weights, LLaMA checkpoint references via Groq).
• CSV outputs under src/data/output for visualization and downstream modules.
• (Optionally) a database or object store for production‐grade persistence.
d. External Services
• Groq API for LLaMA inference.
• Optional cloud storage or real‐time camera feeds.
Relationships & Data Flow
• User interacts with Frontend → triggers REST calls to Backend.
• For Spoilage & Waste Prediction: historical data or live inputs → preprocessor → model inference (LLaMA/XGBoost/Prophet) → output CSVs/JSON → API returns predictions → front-end dashboards (SpoilageForecast, WasteQuantifier).
• For Menu Optimization: near‐expiry item list → recipe generator & cost optimizer → recommended dishes → UI component (DailySpecials).
• Data flows bi-directionally: user uploads sales CSV → backend ingest → forecasting → feed results back to UI (SalesPredictor).
Important Architectural Patterns
• Modular ML pipelines: each domain (vision, forecasting, generative AI) lives in own package under backend/src.
• Clear separation of concerns: API layer vs. data preprocessing vs. prediction modules.
• Stateless backend with potential for horizontal scaling behind a load balancer.
• Frontend is a single‐page application, decoupled from backend.