title: Shelf Scribe
emoji: π
colorFrom: green
colorTo: gray
sdk: gradio
sdk_version: 6.16.0
app_file: app.py
pinned: false
license: mit
short_description: AI restocking and pricing assistant for small retail shops.
Shelf Scribe: AI Retail Restocking & Pricing Assistant
Shelf Scribe is an AI-assisted retail workflow optimizer designed specifically for small, independent shop owners, convenience stores, kiosks, grocery stores, and pharmacies. It turns messy photos of store shelves and supplier invoices/receipts into a practical, action-oriented restocking and pricing dashboard.
Instead of positioning this as a fully autonomous (and risky) inventory system, Shelf Scribe serves as an AI-assisted restock and shelf-label checklist. The human shop owner remains in control, reviewing pricing suggestions, editing the catalog, and confirming supplier orders.
π Key Features & Hackathon Merit Badges
- Double Execution Flow: Supports Cached Demo Mode for fast, local, offline testing during judging, alongside Live VLM Inference Mode to process user uploads.
- Deterministic Reconciliation: Uses a custom Python engine with fuzzy name matching and alias lookups to align messy visual OCR text with catalog entries.
- Reorder Calculations with Pack Rounding: Auto-flags low-stock items and rounds up reorder recommendations to whole pack sizes (e.g. cartons of 12 or 24).
- Margin Auditing: Compares invoice costs with catalog prices and alerts the owner if wholesale price hikes violate their target gross profit margins.
- Outputs Ready for Action: Generates a copy-to-clipboard WhatsApp message to order items, plus print-ready shelf labels in HTML and PDF layouts.
- Local-First Database: Uses a lightweight SQLite database (
shelf_scribe.db) to persist the product catalog, edit settings, and track detections.
π¦ Project Layout
.
βββ app.py # Main Gradio application interface
βββ config.py # Centralized configuration and environment settings
βββ database.py # Root database connection wrapper
βββ models.py # LLM loading and structured extraction triggers
βββ reconciliation.py # Fuzzy matcher, pricing checks, PO & label HTML formatting
βββ pdf_generator.py # Compiles purchase orders and label sheets using ReportLab
βββ requirements.txt # Python dependency lists
βββ run.sh # Executable runner script with venv auto-activation
βββ verify_code.py # Code quality verification (lint & format)
βββ pyrightconfig.json # Python type checker configuration
βββ database/ # SQLite connection and schema layer
β βββ __init__.py
β βββ connection.py # Global SQLite connection pool
β βββ schema.py # Database tables creation statements
β βββ seed.py # Seeding products catalog database
βββ demo_data/ # Pre-computed VLM extraction outputs (JSON)
β βββ snacks_cached.json
β βββ drinks_cached.json
β βββ toiletries_cached.json
βββ docs/ # Detailed hackathon documentation
β βββ PROJECT_BRIEF.md # Detailed problem definition and business fit
β βββ ARCHITECTURE.md # Algorithmic flows and database design
β βββ DEMO_SCRIPT.md # Testing script for hackathon judges
β βββ DATA_COLLECTION_GUIDE.md # Store photography guidelines
βββ static/ # Client-side style overrides and javascript utilities
βββ style.css # Premium retail dark-mode CSS styles
βββ script.js # Clipboard copying, toast notifications, window print
βββ demo_images/ # Synthetic photos for demo scenarios
βββ snacks_shelf.png
βββ drinks_shelf.png
βββ toiletries_shelf.png
π§ Local Installation & Execution
1. Prerequisites
Get a Hugging Face API write token with access to gated model repositories.
2. Set Up Environment Variables
Create a .env file in the root directory:
HF_TOKEN=your_huggingface_write_token_here
3. Run Using the Runner Script
The ./run.sh script automatically detects, activates, and configures the Python virtual environment:
- Initialize the Database:
./run.sh db - Launch the Web Server:
./run.sh - Verify Code Format & Quality:
./run.sh verify