sidewalk-fm / README.md
Joshua-Abok's picture
Update README.md
d27bd8d verified
|
Raw
History Blame Contribute Delete
6.88 kB

A newer version of the Gradio SDK is available: 6.20.0

Upgrade
metadata
title: Sidewalk FM
sdk: gradio
tags:
  - sidewalk-fm
  - gradio
  - hackathon
  - build-small
  - tiny-titan
  - backyard-ai
  - best-agent
  - off-brand
  - best-demo
  - nvidia-nim
  - modal
  - well-tuned
  - swahili
  - multilingual
license: mit

Hackathon Entry
HuggingFace Build Small Hackathon 2026 β€” Backyard AI track
πŸ† Tiny Titan + Best Agent + Off Brand + Best Demo + Well-Tuned + NVIDIA Sponsor + Modal

For a real person: Mama Aisha, a morning-market produce trader who speaks Kiswahili and English. She logs sales by voice in her own language and hears whether she's making a profit β€” no typing, no accountant.

"What's your biggest expense today?"
"I spent 500 shillings on mangoes, but I don't know if I'm making a profit."

Sidewalk FM helps small traders track purchases, sales, and margins in plain English.
It's for the person who runs a shop on the street β€” not the accountant.


🧠 Models Used

Role Model Size Provider Badge Eligible
Extraction nvidia/nemotron-mini-4b-instruct 4B NVIDIA NIM βœ… Tiny Titan
Advisory nvidia/nemotron-mini-4b-instruct 4B Modal vLLM (T4) β†’ deterministic fallback βœ… Tiny Titan + Modal
Voice β€” Kiswahili Joshua-Abok/finetuning-wav2vec-large-swahili-asr-model_v12 ~1B (our fine-tune, WER 14.36%) HF Inference βœ… Tiny Titan + Well-Tuned
Voice β€” English / code-switch openai/whisper-large-v3 β€” HF Inference multilingual fallback

Every model ≀4B β†’ Tiny Titan. We fine-tuned and published the Kiswahili ASR model β†’ Well-Tuned. Advisory served on Modal β†’ Modal prize. NVIDIA Nemotron throughout β†’ NVIDIA prize.

🌍 Why this wins for a real trader (Backyard AI)

Mama Aisha can't type fast and isn't an accountant β€” but she speaks. Sidewalk FM is voice-first and bilingual (English + Kiswahili), using a Swahili model we fine-tuned ourselves so it actually understands a Nairobi market trader, not generic English. The ledger and profit math are deterministic Python (never the LLM), so the numbers are always right and the demo never breaks.


🧩 Features

  • Natural Language Input: "bought 50 mangoes at 200 shillings each"
  • Bilingual Voice Input: Click the mic 🎀 and speak in English or Kiswahili β€” Swahili uses our fine-tuned wav2vec2 model, English/code-switch uses Whisper, gated so it never breaks
  • Structured Ledger: Transactions parsed and stored with full metadata
  • Deterministic Math: Revenue, costs, profit calculated with pure Python β€” never the LLM
  • AI Advisory: Get actionable advice on inventory and pricing via NVIDIA NIM or Modal vLLM
  • Custom HTML Ledger UI: Styled tables with color-coded margins (Off Brand badge)
  • Structured Agent Traces: Every extraction, validation, and advisory step is logged for audit πŸ“‘
  • Voice-to-Ledger: Full text flow β€” log a sale β†’ see margin β†’ get advice β€” all in one demo

πŸ“¦ Deployment

HF Space (Gradio)

The Gradio app (app.py) uses NVIDIA NIM for extraction and advisory.

pip install -r requirements.txt
python app.py

Deploy to HF Spaces

  1. Push to a repo (this one)
  2. Create Space with gradio runtime
  3. Add API keys to Secrets: NVIDIA_NIM_API_KEY

πŸ–₯ Modal vLLM (Optional β€” On-Prem Advisory)

For a hosted advisory model on Modal GPU, use the Modal deployment:

modal deploy modal_serve_qwen3b.py

Hard Deployment Constraints

  1. GPU: L4 β€” Nemotron 4B with comfortable VRAM headroom
  2. Only 1 GPU β€” no multi-GPU setups
  3. min_containers=1 β€” endpoint stays warm, never scales to 0

API Endpoints

  • GET /health β€” Model health check
  • GET /v1/models β€” Available models
  • POST /v1/chat/completions β€” OpenAI-compatible chat completions

πŸ“Š Architecture

User Input (natural language)
        β”‚
        β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Deterministic   β”‚ ← Regex/rules: fast, reliable, no hallucination
β”‚  Extraction      β”‚ ← "bought 50 mangoes at 200 shillings"
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
    [regex failed?]
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  NIM Fallback    β”‚ ← nemotron-mini-4b-instruct for messy input
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Validation     β”‚ ← Hard rules: qty > 0, action in {buy,sell,return}
β”‚   & Ledger       β”‚ ← Pure Python struct, deterministic
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Deterministic   β”‚ ← calculate_margins() β€” never the LLM
β”‚  Math Engine     β”‚ ← revenue, costs, profit, margin%
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
    β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”
    β”‚         β”‚
    β–Ό         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Rule β”‚  β”‚  Modal   β”‚
β”‚ Basedβ”‚  β”‚  vLLM    β”‚
β”‚Adviceβ”‚  β”‚ Advisory β”‚
β””β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🎯 Badges Targeted

Badge Status
Backyard AI βœ… Track real-world problems (street traders)
Tiny Titan βœ… FULL β€” all models ≀4B (nemotron-mini-4b-instruct)
Best Agent βœ… Multi-step tool use (parse β†’ validate β†’ ledger β†’ analyze β†’ advise)
Off Brand βœ… Custom ledger UI (not a chatbot)
Best Demo βœ… Story + video + social post
Well-Tuned βœ… Our fine-tuned & published Kiswahili wav2vec2 model (WER 14.36%)
NVIDIA Sponsor βœ… Full NVIDIA stack (Nemotron Mini 4B on NIM + Modal)
Modal β€” Best Use βœ… Advisory served on Modal (vLLM) at runtime

πŸ“‘ Structured Agent Traces

Every action in the pipeline is logged with structured traces:

Step Fields
extraction method (regex/llm), success, fields
validation success, error
advisory method (rule/nim/modal), success, error

This provides full auditability β€” judges can trace exactly how every answer was reached.


links

https://www.linkedin.com/posts/joshuaabok_buildsmallhackathon-buildsmall-huggingface-share-7472437382152179712-Q3jX/?utm_source=share&utm_medium=member_desktop&rcm=ACoAAF92zkABF9X9x72P-GywndHGRVJCSFAjFL8

https://youtu.be/uzu377Yq_EM

πŸ“ License

MIT