diff --git "a/data/quest_label_input.json" "b/data/quest_label_input.json"
new file mode 100644--- /dev/null
+++ "b/data/quest_label_input.json"
@@ -0,0 +1 @@
+{"taxonomy_text": "- Off the Grid (Local-first): Runs entirely on local or open-weight models with no proprietary cloud inference APIs. Signals: local transformers/llama.cpp/vLLM model load, GGUF weights, no openai/anthropic/gemini/cohere API client.\n- Well-Tuned (Fine-tuned): Uses or publishes a fine-tuned or LoRA-adapted model rather than only stock checkpoints. Signals: LoRA/PEFT adapter, fine-tuned model repo, training script, words like fine-tune, adapter, SFT, distilled.\n- Off-Brand (Custom frontend): Ships a custom interface beyond default Gradio styling, with a memorable look or voice. Signals: custom CSS/HTML/JS, gr.HTML, gr.Blocks theme/css=, gr.Server, custom components, bespoke theming.\n- Llama Champion (llama.cpp path): Runs a model through the llama.cpp runtime. Signals: llama-cpp-python, from llama_cpp import Llama, GGUF file, llama.cpp, Llama( constructor.\n- Sharing is Caring (Shareable artifact): Produces an output people can save, post, or compare, or publishes an agent trace to the Hub. Signals: download/export button, gr.File/gr.DownloadButton, save PNG/PDF/JSON, push_to_hub of a trace or dataset.\n- Field Notes (Build notes): Documents the build itself with notes, a write-up, or a blog/report link. Signals: README has a substantial build write-up, devlog, lessons learned, or a blog/report/Notion link.\n- Backyard AI (Real problem for one person): Solves a concrete real-world problem for a specific, named person or persona. Signals: README frames a real user and task (caregiving, a relative, a job, a household chore), practical utility.\n- Thousand Token Wood (Delightful & creative): A delightful, playful, or artistic experience that would not exist without AI. Signals: story/game/art/whimsy framing, generative characters or worlds, playful tone, creative novelty.\n- OpenBMB (OpenBMB model): Uses an OpenBMB model such as the MiniCPM family. Signals: model repo openbmb/..., MiniCPM, MiniCPM-V, MiniCPM5, OpenCPM.\n- Nemotron (NVIDIA Nemotron): Uses an NVIDIA Nemotron model (Nemotron LLM, Parakeet, Nemotron-Speech, Canary). Signals: model repo nvidia/...nemotron..., Parakeet, nemotron-speech, Canary ASR.\n- Modal (Modal-powered): Uses Modal for training, inference, or background compute. Signals: import modal, modal.App, @app.function, Modal endpoint/volume, README cites Modal compute.\n- Tiny Titan (Small model (<=4B)): Runs on a genuinely small model of about four billion parameters or fewer. Signals: declared model is 0.5B/1B/1.5B/2B/3B/4B or labelled tiny/small/nano/mini (e.g. Qwen2.5-1.5B, MiniCPM5-1B, gemma-2b).\n- Best Agent (Agentic): An agentic build: tool use, function calling, planning, or an autonomous multi-step loop. Signals: tool/function calling, an agent/planner loop, multiple orchestrated tools, ReAct, multi-step reasoning over tools.", "count": 108, "projects": [{"id": "build-small-hackathon/dental-soap", "slug": "dental-soap", "title": "Dental SOAP", "sdk": "gradio", "models": ["Qwen/Qwen3-4B-Instruct-2507"], "tags": ["agents", "bilingual", "healthcare", "zero-gpu"], "app_file": "app.py", "structural_profile": "both", "readme": "# Dental SOAP A doctor could not clearly explain his own crown, root canal, bite, and TMJ story to his dentist, so he built a small-model visit-prep tool that turns patient chaos into a one-page dentist handoff. Dental SOAP is not an AI dentist. It is a patient education and visit-documentation aid. It organizes patient-reported history to bring to a licensed dentist. It does not diagnose, interpret imaging, prescribe medication, or choose a dental procedure. Fixed safety rules can advise urgent in-person care. ## Why This Exists (A Real Case) The builder's own case took three months and two specialties to untangle: an extraction with an immediate sinus repair, a crown that felt high from day one, a molar adjusted five times without relief, jaw/TMJ soreness — and finally an ENT confirming the sinus infection that tied it together. Referred pain does not respect specialty boundaries; the only thing that crossed them cleanly was a written handoff a clinician could scan in under a minute. He lived that workflow manually with a frontier cloud model between real appointments. Dental SOAP is the Build Small answer: the same narrow job, done by a 4B open model inside the Space, with deterministic rules guarding safety. The `Try Ahmed's case` example **is** that case, de-identified — and the `repeated bite adjustments without lasting relief` safety rule exists because it happened to him. **Try it in 10 seconds:** click **Try Ahmed's case** — the handoff renders instantly from a valid ...", "app": "from __future__ import annotations\nfrom pathlib import Path\nfrom typing import Any\nfrom examples import CHECK_OPTIONS, EXAMPLES, STEP2_CHECKS, STEP3_CHECKS, STEP4_CHECKS\nfrom interview_schema import ExtractedIntake, extracted_to_intake\nfrom pdf_export import build_pdf\nfrom render import (\nfrom safety_rules import evaluate_red_flags\nfrom pydantic import ValidationError\nfrom schema import (\nfrom transformers import AutoModelForCausalLM, AutoTokenizer as _AutoTokenizer\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\nfrom __future__ import annotations\n\nimport dataclasses\nimport json\nimport os\nimport re\nimport sys\nimport threading\nfrom pathlib import Path\nfrom typing import Any\n\nimport gradio as gr\n\nclass AgentUnavailable(RuntimeError):\n \"\"\"The local model endpoint could not produce a usable response.\"\"\"\n\nimport interview as interview_mod\nfrom examples import CHECK_OPTIONS, EXAMPLES, STEP2_CHECKS, STEP3_CHECKS, STEP4_CHECKS\nfrom interview_schema import ExtractedIntake, extracted_to_intake\nfrom pdf_export import build_pdf\nfrom render import (\n footer_html,\n header_html,\n initial_safety_html,\n placeholder_handoff_html,\n plain_text_handoff,\n rail_html,\n render_handoff_html,\n render_safety_html,\n step_head,\n initial_agent_dashboard_html,\n render_agent_dashboard,\n)\nfrom safety_rules import evaluate_red_flags\nfrom pydantic import ValidationError\nfrom schema import (\n BLOCKED_QUESTION_TERMS,\n EvidenceSpan,\n HandoffOutput,\n ModelHandoffDraft,\n PatientProfile,\n StructuredIntake,\n model_text_is_safe,\n)\n\n\ntry:\n import spaces\nexcept Exception:\n class _SpacesFallback:\n @staticmethod\n def GPU(fn=None, /, *, duration: int = 120):\n # Support both @spaces.GPU (fn is callable) and @spaces.GPU(duration=N)\n # (fn is None, returns a decorator).\n def decorator(f): ..."}, {"id": "build-small-hackathon/pakistan-notice-helper", "slug": "pakistan-notice-helper", "title": "Pakistan Notice Helper", "sdk": "gradio", "models": [], "tags": ["backyard-ai", "build-small-hackathon", "gradio", "llama.cpp", "modal"], "app_file": "app.py", "structural_profile": "both", "readme": "# Pakistan Notice Helper Pakistan Notice Helper is a MiniCPM-V-powered safety assistant for confusing or suspicious Pakistani notices, bills, SMS messages, bank alerts, FBR-style messages, challans, and courier/customs messages. It accepts pasted text and screenshots, then returns: - **Risk label:** Looks normal, Verify first, Suspicious, or Likely scam - A simple English explanation - Red flags found - Safe next steps - A polite reply draft The interface is a custom mobile-first frontend served by [`gradio.Server`](https://www.gradio.app/main/guides/server-mode). Gradio provides queueing, API routes, and Hugging Face Spaces hosting without exposing a default Gradio UI. > **Pakistan Notice Helper does not provide official verification. It checks > common scam signals and gives safe next steps. Always verify through official > websites or helplines before making payments or sharing personal > information.** ## Build Small Hackathon This is a **Backyard AI** project built for the [Build Small Hackathon](https://huggingface.co/build-small-hackathon). It addresses a common local problem: people receive convincing payment notices, bank alerts, courier messages, challans, and government impersonation scams but may not know which details are unsafe. - **Space:** [build-small-hackathon/pakistan-notice-helper](https://huggingface.co/spaces/build-small-hackathon/pakistan-notice-helper) - **Source:** [kingabzpro/pakistan-notice-helper](https://github.com/kingabzpro/pakistan-notice-helpe ...", "app": "from __future__ import annotations\nfrom io import BytesIO\nfrom pathlib import Path\nfrom typing import Any\nfrom fastapi.responses import FileResponse\nfrom fastapi.staticfiles import StaticFiles\nfrom gradio import Server\nfrom PIL import Image, ImageOps, UnidentifiedImageError\nfrom traces.runtime import queue_trace, start_trace_worker, trace_status\nfrom huggingface_hub import hf_hub_download\nfrom llama_cpp import Llama\nfrom llama_cpp.llama_chat_format import MTMDChatHandler\nfrom llama_cpp import Llama, llama_cpp\n\n\"\"\"Pakistan Notice Helper: custom frontend with a queued Gradio backend.\"\"\"\n\nfrom __future__ import annotations\n\nimport argparse\nimport base64\nimport ctypes\nimport gc\nimport importlib.util\nimport json\nimport logging\nimport os\nimport re\nimport sys\nimport threading\nimport time\nfrom io import BytesIO\nfrom pathlib import Path\nfrom typing import Any\n\nimport spaces\nfrom fastapi.responses import FileResponse\nfrom fastapi.staticfiles import StaticFiles\nfrom gradio import Server\nfrom PIL import Image, ImageOps, UnidentifiedImageError\nfrom traces.runtime import queue_trace, start_trace_worker, trace_status\n\nROOT = Path(__file__).resolve().parent\nSTATIC_DIR = ROOT / \"static\"\nDISCLAIMER = (\n \"Pakistan Notice Helper does not provide official verification. It checks \"\n \"common scam signals and gives safe next steps. Always verify through \"\n \"official websites or helplines before making payments or sharing personal \"\n \"information.\"\n)\nRISK_LABELS = (\"Looks normal\", \"Verify first\", \"Suspicious\", \"Likely scam\", \"Inappropriate\")\nDEFAULT_MODEL_REPO = \"openbmb/MiniCPM-V-4.6-gguf\"\nDEFAULT_MODEL_FILE = \"MiniCPM-V-4_6-Q4_K_M.gguf\"\nDEFAULT_MMPROJ_FILE = \"mmproj-model-f16.gguf\"\nMAX_IMAGE_BYTES = 8 * 1024 * 1024\nMAX_IMAGE_PIXELS = 40_000_000\nDEFAULT_IMAGE_MAX_DIMENSION = 1536\nDEFAULT_IMAGE_JPEG_QUALITY = 90\nREQUIRED_FIELDS = {\n \"risk_label\",\n \"simple_explanation\",\n \" ..."}, {"id": "build-small-hackathon/Kintsugi-Garden", "slug": "Kintsugi-Garden", "title": "The Kintsugi Garden", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "
# The Kintsugi Garden > *A symbolic mirror for dreams, journals, and inner transitions.* **This is not therapy, diagnosis, prediction, or advice. It is a symbolic reflection tool.** The Kintsugi Garden is a small-model symbolic reflection app. You give it a dream, a journal entry, an emotional trigger, a relationship pattern, a recurring symbol, or a life transition, and it offers back a *symbolic reading*: archetypal themes, possible shadow patterns, individuation signals, a gentle question, and a session-based **Soul Map**. Like the Japanese art of *kintsugi* — mending broken pottery with gold — the app treats the cracks and wounds in our inner stories as places where meaning and value can gather, never as something to diagnose or fix. --- ## Project overview The app accepts free-form text and surrounds a lightweight instruction-tuned language model with deterministic Python scaffolding: - a curated **symbolic lexicon** (40+ symbols, each with meanings, archetypes, shadow motifs, and individuation signals); - **symbol extraction** with aliases and simple plural handling; - a session-local **Soul Map** that tracks recurring symbols and themes; - **prompt compression** so only the current entry and its symbols reach the model; - **structured, parsed output** split across calm, focused tabs; - a **deterministic mandala generator** (PIL) that visualizes the symbols ...", "app": "from PIL import Image, ImageDraw, ImageFont\n\n\"\"\"\nThe Kintsugi Garden\nA symbolic mirror for dreams, journals, and inner transitions.\n\nA small-model symbolic reflection app built for the Build Small Hackathon.\n\nThis is NOT therapy, diagnosis, prediction, fortune-telling, or advice.\nIt is a symbolic reflection tool.\n\nThe design philosophy is \"small model, strong scaffolding\": rather than\nrelying on the LLM alone, the app surrounds a lightweight instruction model\n(microsoft/Phi-4-mini-instruct) with deterministic Python:\n\n * a curated symbolic lexicon\n * keyword / symbol extraction with aliases and simple plurals\n * a session-local \"Soul Map\" memory\n * prompt compression (only the current entry + extracted symbols are sent)\n * structured, parsed output\n * deterministic mandala generation with PIL (no image model required)\n\nAuthor: Build Small Hackathon submission\n\"\"\"\n\nimport os\nimport re\nimport sys\nimport json\nimport math\nimport datetime\nimport traceback\n\nimport gradio as gr\nimport pandas as pd\nfrom PIL import Image, ImageDraw, ImageFont\n\n# `spaces` is only available on HF Spaces with zero-* hardware tiers. Guard\n# the import so local development (Mac, Linux, etc.) doesn't hard-fail.\n# Outside HF Spaces, @spaces.GPU becomes a no-op passthrough decorator.\ntry:\n import spaces\nexcept Exception: # pragma: no cover - local dev environments\n class _SpacesStub:\n def GPU(self, *args, **kwargs):\n def decorator(fn):\n return fn\n return decorator\n spaces = _SpacesStub()\n\n# Torch / transformers are imported lazily inside load_model() so that the\n# Gradio interface can still render even if the heavy stack has trouble\n# loading. We import torch eagerly because we need its dtype constants, but\n# guard it so the app never hard-crashes at import time.\ntry:\n import torch\nexcept Exception: # pragma: no cover - extremely defensiv ..."}, {"id": "build-small-hackathon/lolaby", "slug": "lolaby", "title": "Lolaby", "sdk": "gradio", "models": ["build-small-hackathon/lolaby-llama-3b", "openbmb/MiniCPM-V-4_6", "hexgrad/Kokoro-82M"], "tags": ["agentic", "backyard-ai", "build-small-hackathon", "children", "fine-tuned", "gradio", "llama-cpp", "lullaby", "on-device", "small-models", "text-to-audio"], "app_file": "app.py", "structural_profile": "both", "readme": "# Lolaby — AI-powered lullabies > *A tiny AI that watches your child's drawings and sings them a personalised lullaby.* Built for the [Hugging Face **Build Small Hackathon 2026**](https://huggingface.co/build-small-hackathon) · **Backyard AI** track 🏡 **Try it:** [the live Space](https://huggingface.co/spaces/build-small-hackathon/lolaby) · **Demo video:** [60-second walkthrough](placeholder_demo_video_url) · **Model:** [`lolaby-llama-3b` on the Hub](https://huggingface.co/build-small-hackathon/lolaby-llama-3b) · **Field notes:** [the build journal](placeholder_blog_url) --- ## The Problem My partner's sister is a kindergarten teacher, who runs nap time for fifteen 4-year-olds on a daily basis. Every child wants the same thing at the start of nap: *\"sing me a song with my name in it.\"* She'd love to give each child their own song, drawn from what they actually love that week (a stuffed fox, a new puppy, the rainbow). She doesn't have time, musical expertise nor a tool. **Lolaby is the tool.** The child shows Lola what they love — either by doodling on screen, or by handing the teacher a paper drawing for her to snap a photo of. The teacher types their name. A small, on-device AI watches the drawing, writes them a lullaby about it, and sings it back — in about a minute. Everything runs locally. No cloud LLM, no per-song API cost, no children's drawings or names ever leaving the device. ## How it works  **The drawing is optional.** No canvas draw ...", "app": "from pathlib import Path\nfrom llama_cpp import Llama\nfrom synths.guitar import GuitarSynth, ACOUSTIC_PRESET, SR\nfrom synths.piano import PianoSynth\nfrom synths.harp import HarpSynth\nfrom synths.xylophone import XylophoneSynth\nfrom synths.ocarina import WhistleSynth\nfrom synths.musicbox import MusicBoxSynth\nfrom synths.voice import speak_lyrics, SR_TARGET\nfrom utils import trace as lola_trace\nfrom utils.safety import screen_inputs\nfrom synths.voice import _load_kokoro\n\n\"\"\"\nLullaby Llama — personalized bedtime music, generated on-device.\n\nThree-layer audio:\n 1. Rhythm layer — user-selected instrument plays the chord progression.\n 2. Melody layer — user-selected instrument plays a melodic line over the chords.\n 3. Voice layer — Kokoro reads the lyrics, soft preset, slow pacing.\n\nThe user picks both layers with image buttons in the UI.\n\nAesthetic: children's drawing — crayon textures, wobbly hand-drawn borders.\n\"\"\"\n\nimport base64\nimport glob\nimport os\nimport random\nimport re\nimport tempfile\nimport time\nimport uuid\nfrom pathlib import Path\n\nimport gradio as gr\nimport numpy as np\nimport soundfile as sf\nfrom llama_cpp import Llama\n\nfrom synths.guitar import GuitarSynth, ACOUSTIC_PRESET, SR\nfrom synths.piano import PianoSynth\nfrom synths.harp import HarpSynth\nfrom synths.xylophone import XylophoneSynth\nfrom synths.ocarina import WhistleSynth\nfrom synths.musicbox import MusicBoxSynth\nfrom synths.voice import speak_lyrics, SR_TARGET\nfrom utils import trace as lola_trace\ntry:\n from utils.safety import screen_inputs\nexcept ImportError:\n # safety.py absent — degrade to a no-op screen rather than crash.\n def screen_inputs(loves, fears):\n return (True, \"\", [])\n\n# Vision module (drawing → \"loves\" phrase). Falls back to stroke analysis\n# internally if MiniCPM-V can't load, so the drawing input always produces\n# SOMETHING for the lullaby to be about.\ntry:\n imp ..."}, {"id": "build-small-hackathon/exam-panic-rescue", "slug": "exam-panic-rescue", "title": "Exam Panic Rescue", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# Exam Panic Rescue Exam Panic Rescue turns a student's last-minute panic dump into a survival plan, drill deck, triage clock, panic-pattern readout, proof target, final sheet, study receipt, and field-note prompt. The first target workflow is a student who has an exam soon, feels stuck, and cannot decide what to study first. The app is intentionally narrow: one stressed student, one exam, one time box, one final sheet. The app includes four clearly labeled sample scenarios for quick evaluation: biology definitions, physics numericals, history long answers, and math MCQ traps. They are not claimed as real-user data; they are the same public readiness cases used by the local smoke test and published as [data/readiness_cases.jsonl](data/readiness_cases.jsonl). A real student should replace the sample with their actual exam, topics, and time left before generating a packet. The public UI keeps the student workflow first and puts build-proof/claim status in a small collapsible section so sponsor evidence does not distract from the product. ## Build Status This is a staging-ready Build Small project in progress. The public Space is live and smoke-tested at https://huggingface.co/spaces/build-small-hackathon/exam-panic-rescue. Final hackathon submission assets still need the demo video, social post, and verified optional runtime claims. Public build notes and demo prep are drafted in [docs/codex-build-trace.md](docs/codex-build-trace.md) and [docs/demo-script.md](docs/demo-script.m ...", "app": "from __future__ import annotations\nfrom study_engine import DEMO_CASES, EXAMPLE_INPUT, build_rescue_plan\n\nfrom __future__ import annotations\n\nimport os\n\nimport gradio as gr\n\ntry:\n import spaces\nexcept ImportError: # Local tests should not require the HF Spaces runtime package.\n class _SpacesFallback:\n @staticmethod\n def GPU(*args, **kwargs):\n def decorator(fn):\n return fn\n\n return decorator\n\n spaces = _SpacesFallback()\n\nfrom study_engine import DEMO_CASES, EXAMPLE_INPUT, build_rescue_plan\n\n\nCSS = \"\"\"\n:root {\n --ink: #071613;\n --muted: #1c342f;\n --muted-soft: #27423c;\n --paper: #f4e2c5;\n --card: #fffaf0;\n --card-solid: #fff8ea;\n --field: #fffef9;\n --line: #5e5545;\n --green: #005844;\n --green-dark: #032f28;\n --coral: #84231b;\n --gold: #755004;\n --blue: #073e58;\n --graph: rgba(7, 62, 88, 0.11);\n --shadow: rgba(37, 29, 16, 0.20);\n}\n\n.gradio-container {\n background:\n radial-gradient(circle at 8% 8%, rgba(183, 67, 54, 0.18), transparent 26%),\n radial-gradient(circle at 92% 4%, rgba(0, 108, 91, 0.18), transparent 24%),\n linear-gradient(var(--graph) 1px, transparent 1px),\n linear-gradient(90deg, var(--graph) 1px, transparent 1px),\n var(--paper);\n background-size: auto, 24px 24px, 24px 24px, auto;\n color: var(--ink);\n font-family: \"Trebuchet MS\", \"Segoe UI\", ui-sans-serif, system-ui, sans-serif;\n -webkit-font-smoothing: antialiased;\n text-rendering: optimizeLegibility;\n min-height: 100vh;\n}\n\n.gradio-container,\n.gradio-container * {\n text-shadow: none !important;\n}\n\n.gradio-container button:focus-visible,\n.gradio-container textarea:focus-visible,\n.gradio-container input:focus-visible,\n.gradio-container select:focus-visible {\n outline: 3px solid rgba(0, 108, 91, 0.34) !important;\n outline-offset: 2px !important;\n}\n\n.app-shell {\n max-width: 1240px;\n margin: 0 auto;\n padding: 24 ..."}, {"id": "build-small-hackathon/AI-agent-Evaluation-pipeline", "slug": "AI-agent-Evaluation-pipeline", "title": "ai agent evaluation pipeline", "sdk": "gradio", "models": [], "tags": ["agents", "evaluation", "gradio", "llm", "observability"], "app_file": "app.py", "structural_profile": "both", "readme": "# 🧪 AI Agent Evaluation Pipeline > Evaluate AI agents at **Session**, **Trace**, and **Span** levels — inspired by [Amazon Bedrock AgentCore Evaluations](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/evaluations.html) ## Overview This tool provides a structured framework for evaluating AI agent conversations using the same three-level hierarchy as Amazon Bedrock AgentCore Evaluations: ``` 📦 Session → Did the agent achieve the user's overall goal? └── 🔄 Trace → Per-turn quality (helpfulness, coherence, relevance...) └── 🔧 Span → Per tool-call accuracy ``` ## Features - **14 built-in evaluators** (1 session + 11 trace + 2 span) - **Heuristic mode** — works offline, no API key required - **3 demo traces** (Simple Q&A, Tool Calling, Multi-turn) - **Ground truth support** — `expected_response`, `expected_trajectory`, `assertions` - **Visual results** — radar chart, bar chart, heatmap, score cards ## Evaluators ### 📦 Session Level (1) | Evaluator | Description | | ----------------- | --------------------------------------------------- | | Goal Success Rate | Did the agent fully achieve the user's stated goal? | ### 🔄 Trace Level (11) | Evaluator | Description | | ----------------------- | ----------------------------------------------------------- | | Helpfulness | Does the response help the user progress toward their goal? | | Correctness | Is the response factually correct? | | Coherence | Is the reasoning logically consistent and well-structured? | | Conciseness ...", "app": "from pathlib import Path\nfrom src.evaluators import (\nfrom src.llm_judge import LLMJudge\nfrom src.models import EvalLevel, EvalMode, GroundTruth\nfrom src.parser import format_trace_tree, parse_trace\nfrom src.reliability import compute_reliability\nfrom src.runner import EvalRunner\nfrom src.visualizer import create_bar_chart, create_radar_chart, create_trace_timeline\nfrom urllib.parse import urlparse\nfrom huggingface_hub import hf_hub_download\n\n#!/usr/bin/env python3\n\"\"\"\nAI Agent Evaluation Pipeline — Gradio MVP\n==========================================\nEvaluate AI agents at 3 hierarchical levels, inspired by\nAmazon Bedrock AgentCore Evaluations.\n\n 📦 Session — Did the agent achieve the user's goal?\n 🔄 Trace — Per-turn quality (11 evaluators)\n 🔧 Span — Per tool-call accuracy (2 evaluators)\n\nRun locally : python app.py\nHuggingFace : app_file = app.py (Gradio SDK)\n\"\"\"\n\nimport json\nimport os\nimport sys\nfrom pathlib import Path\n\n# Ensure src/ is importable whether run from repo root or HF Spaces\n_ROOT = Path(__file__).parent\nsys.path.insert(0, str(_ROOT))\n\nimport gradio as gr\n\n# HF ZeroGPU Spaces require at least one @spaces.GPU-decorated function\n# to be detected at module load. The actual evaluation and dataset\n# generation work in this app uses the cloud InferenceClient and runs\n# without local GPU compute; the placeholder below exists only to\n# satisfy the runtime's static check. `spaces` is pre-installed on\n# ZeroGPU hardware; we guard the import so the app still loads if it\n# is missing (e.g. local CPU dev).\ntry:\n import spaces as _spaces\nexcept ImportError:\n class _spaces_stub:\n @staticmethod\n def GPU(fn, duration: int = 60):\n return fn\n _spaces = _spaces_stub()\n\n\n@_spaces.GPU\ndef _zero_gpu_healthcheck() -> dict:\n \"\"\"Placeholder GPU function detected by the ZeroGPU runtime.\"\"\"\n try:\n import torch\n retu ..."}, {"id": "build-small-hackathon/global-leaders", "slug": "global-leaders", "title": "Global Leaders", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": " # 🌍 GLOBAL LEADERS ### *Take the chair. Hold the line. Survive 2025.* **A political-strategy game where a small language model runs the world —** **and you govern a real leader through the real headlines of 2025.** `🇺🇸 Trump` · `🇧🇷 Lula` · `🇷🇺 Putin` · `🇨🇳 Xi` · `🇦🇷 Milei` · `🇫🇷 Macron`    
--- ``` ╔══════════════════════════════════════════════════════════════════════╗ ║ ● GLOBAL LEADERS FRANCE · EMMANUEL MACRON JUL 2025 ║ ╠══════════════════════════════════════════════════════════════════════╣ ║ ▸ EU-US TRADE DEAL COLLAPSES AMID TARIFFS ║ ║ Washington slaps 20% on European exports. Brussels wants you to ║ ║ retaliate; your industries want a deal; the markets want calm. ║ ║ ║ ║ 🔴 Le Pen: \"Let his government crumble — we inherit the wreckage.\" ║ ║ 🟡 EU Commission: \"Hold the line, or the bloc fractures.\" ║ ║ ║ ║ ▶ Pivot to strategic autonomy ▶ Seek a US exemption ✎ your move ║ ╚══════════════════════════════════════════════════════════════════════╝ ``` You take over a **real world leader on 1 January 2025** and govern for **twelve months**, react ...", "app": "from __future__ import annotations\nfrom engine.countries import COUNTRIES, get_country\nfrom engine.game import Game\nfrom engine.llm import FakeLLM\nfrom engine.schemas import Option\nfrom engine.state import INDICATOR_LABELS\nfrom engine.llm_remote import OLLAMA_DEFAULT_MODEL, OllamaCloudLLM\n\n\"\"\"Global Leaders — Gradio app (HuggingFace Space entrypoint).\n\nSituation-Room UI over the headless engine. Backend: Ollama Cloud (Nemotron) if\nOLLAMA_API_KEY is set, otherwise the deterministic FakeLLM so the demo always runs.\n\nHandlers return {component: gr.update(...)} dicts (robust with this many components) and\nthe slow ones are generators that first yield a \"deliberating\" state, then the result.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport os\n\nimport gradio as gr\n\nfrom engine.countries import COUNTRIES, get_country\nfrom engine.game import Game\nfrom engine.llm import FakeLLM\nfrom engine.schemas import Option\nfrom engine.state import INDICATOR_LABELS\n\nBASE = os.path.dirname(os.path.abspath(__file__))\nSFX = {k: os.path.join(BASE, \"assets\", \"sfx\", f\"{k}.wav\")\n for k in (\"blip\", \"backfire\", \"windfall\", \"gameover\", \"victory\")}\n\nMONTHS = [\"\", \"JAN\", \"FEB\", \"MAR\", \"APR\", \"MAY\", \"JUN\",\n \"JUL\", \"AUG\", \"SEP\", \"OCT\", \"NOV\", \"DEC\"]\nSTANCE_DOT = {\"hostile\": \"🔴\", \"neutral\": \"🟡\", \"allied\": \"🟢\"}\nFACTION_LABELS = {\"party_loyalty\": \"Party loyalty\", \"pla_loyalty\": \"PLA loyalty\",\n \"coup_plot_progress\": \"Coup plot\"}\nDIFF = {\"approachable\": (\"🟢\", \"Approachable\"), \"challenging\": (\"🟡\", \"Challenging\"),\n \"brutal\": (\"🔴\", \"Brutal\")}\nCAB_MAX = 12 # largest roster (USA); we build this many buttons and show/hide per country\n\n\ndef load_dotenv() -> None:\n path = os.path.join(BASE, \".env\")\n if os.path.exists(path):\n for line in open(path, encoding=\"utf-8\"):\n line = line.strip()\n if line and not line.startswith(\"#\") and \"=\" in line: ..."}, {"id": "build-small-hackathon/pocket-weather-theater", "slug": "pocket-weather-theater", "title": "Pocket Weather Theater", "sdk": "gradio", "models": ["HuggingFaceTB/SmolLM2-135M-Instruct", "PratikBuilds/pocket-weather-theater-smollm2-135m-lora"], "tags": ["build-small-hackathon", "gradio", "local-inference", "thousand-token-wood", "tiny-models", "transformers"], "app_file": "app.py", "structural_profile": "both", "readme": "# Pocket Weather Theater Pocket Weather Theater is a Thousand Token Wood hackathon project: a small, joyful Gradio toy where impossible weather and pocket props become miniature stage plays. The AI is load-bearing: each run asks the model to produce the core delight of the experience, including the scene, stage direction, object monologue, and summary line. The app then formats that output as a tiny theater program. The page opens with a static ready-state ticket so the Space feels responsive, then prewarms the local tiny performer while the first CPU load settles. The main flow is intentionally simple: click **Play featured scenario**, use **Best starter** to restore the strongest defaults, use **Make it wilder** to remix the setup before running, follow the **Tonight's goal** card, click **Surprise performance**, continue the last run with **Sequel performance**, or make a setup and click **Start performance**. The app now has one-click surprise performances, a sequel button that carries the previous best line into the next hidden detail, a custom illustrated poster, a generated scene poster for every run, a short synthetic stage sound, an animated storyboard with Live Remix reactions, a generated motion card, a generated MP4 scene clip with sound, a generated story-strip image, a one-click download pack, a Best Line spotlight, Scene Details, Performance Notes, a Performance Summary, a downloadable postcard image, a visual Postcard Wall gallery, a Share Card, a live Scene S ...", "app": "from dataclasses import dataclass\nfrom html import escape\nfrom pathlib import Path\nfrom urllib.parse import quote\nfrom PIL import Image, ImageDraw, ImageFont\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\nfrom peft import PeftModel\n\nimport base64\nimport contextlib\nimport math\nimport os\nimport random\nimport re\nimport subprocess\nimport tempfile\nimport wave\nimport threading\nimport zipfile\nfrom dataclasses import dataclass\nfrom html import escape\nfrom pathlib import Path\nfrom urllib.parse import quote\n\nimport gradio as gr\n\ntry:\n from PIL import Image, ImageDraw, ImageFont\nexcept Exception: # pragma: no cover - Pillow is installed in runtime requirements\n Image = None\n ImageDraw = None\n ImageFont = None\n\ntry:\n import imageio.v3 as iio\nexcept Exception: # pragma: no cover - optional video renderer\n iio = None\n\ntry:\n import imageio_ffmpeg\nexcept Exception: # pragma: no cover - optional video/audio muxer\n imageio_ffmpeg = None\n\ntry:\n import torch\n from transformers import AutoModelForCausalLM, AutoTokenizer\nexcept Exception: # pragma: no cover - keeps Space shell import-friendly while deps install\n torch = None\n AutoModelForCausalLM = None\n AutoTokenizer = None\n\ntry:\n from peft import PeftModel\nexcept Exception: # pragma: no cover - optional until dependencies finish installing\n PeftModel = None\n\n\nMODEL_ID = os.getenv(\"MODEL_ID\", \"HuggingFaceTB/SmolLM2-135M-Instruct\")\nTUNED_ADAPTER_ID = os.getenv(\"TUNED_ADAPTER_ID\", \"PratikBuilds/pocket-weather-theater-smollm2-135m-lora\")\nMAX_NEW_TOKENS = int(os.getenv(\"MAX_NEW_TOKENS\", \"52\"))\nPOSTER_PATH = Path(__file__).resolve().parent / \"assets\" / \"pocket-weather-poster.png\"\nMEDIA_DIR = Path(tempfile.gettempdir()) / \"pocket_weather_theater_media\"\nMEDIA_DIR.mkdir(parents=True, exist_ok=True)\nSPACE_URL = \"https://huggingface.co/spaces/build-small-hackathon/pocket-weather-theate ..."}, {"id": "build-small-hackathon/Trollsona", "slug": "Trollsona", "title": "Trollsona", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# Trollsona / Your Troll Alterego **Tagline:** Summon the little menace living behind your respectable personality. **Track:** An Adventure in Thousand Token Wood **Build target:** Hugging Face Space, Gradio app, small-model constraint `<=32B`. **GitHub repo:** https://github.com/rthgit/Trollsona **Official Build Small Space:** https://huggingface.co/spaces/build-small-hackathon/Trollsona **Backup Space:** https://huggingface.co/spaces/RthItalia/Trollsona Trollsona is a playful Gradio experience that turns a short user confession into a theatrical troll alter ego. The app returns a dossier-style result card with a trollsona name, a warm roast, one useful slap, and a goblin meter. Built with a compact RthItalia model derived from `Qwen/Qwen2.5-3B-Instruct`, under `32B` parameters. The deployed Space is configured to try that model first, then a lightweight Qwen 0.5B model, then the deterministic local fallback if model loading or generation is unavailable. The official public Space currently runs the lightweight Qwen fallback on CPU, while the custom RthItalia compact 3B path is enabled automatically when CUDA is available. ## Features - Immersive Gradio UI for Hugging Face Spaces - Theatrical trollsona result card - Local Hugging Face Transformers generation path for the primary AI runtime - Secondary lightweight Transformers model fallback - Deterministic fallback generator for final resilience - Safe roast guard for non-hateful, non-identity-targeted humor - Persona dropdow ...", "app": "from __future__ import annotations\nfrom functools import lru_cache\nfrom typing import Any\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\nfrom __future__ import annotations\n\nimport hashlib\nimport html\nimport json\nimport os\nimport re\nfrom functools import lru_cache\nfrom typing import Any\n\n\nAPP_TITLE = \"Trollsona\"\nAPP_SUBTITLE = \"Summon the little menace living behind your respectable personality.\"\nTRACK_NAME = \"An Adventure in Thousand Token Wood\"\nDEFAULT_MODEL_ID = \"RthItalia/nano_compact_3b_qkvfp16\"\nDEFAULT_FALLBACK_MODEL_ID = \"Qwen/Qwen2.5-0.5B-Instruct\"\nMAX_PROFILE_CHARS = 700\nMAX_NAME_CHARS = 36\n\n\ndef parse_bool_env(name: str, default: bool) -> bool:\n raw_value = os.getenv(name)\n if raw_value is None:\n return default\n normalized = raw_value.strip().lower()\n if normalized in {\"1\", \"true\", \"yes\", \"on\"}:\n return True\n if normalized in {\"0\", \"false\", \"no\", \"off\"}:\n return False\n return default\n\n\ndef parse_int_env(name: str, default: int, min_value: int, max_value: int) -> int:\n raw_value = os.getenv(name)\n if raw_value is None:\n return default\n try:\n value = int(raw_value)\n except ValueError:\n return default\n return max(min_value, min(max_value, value))\n\n\nMODEL_ID = os.getenv(\"TROLLSONA_MODEL_ID\", DEFAULT_MODEL_ID)\nFALLBACK_MODEL_ID = os.getenv(\"TROLLSONA_FALLBACK_MODEL_ID\", DEFAULT_FALLBACK_MODEL_ID)\nMODEL_ENABLED = parse_bool_env(\"TROLLSONA_ENABLE_MODEL\", default=False)\nMAX_NEW_TOKENS = parse_int_env(\"TROLLSONA_MAX_NEW_TOKENS\", 200, 32, 512)\n\n\nPERSONA_STYLES = {\n \"Back-Alley Oracle\": {\n \"flavor\": \"candlelit prophecy from a very suspicious side street\",\n \"noun_pool\": [\"Candle\", \"Omen\", \"Alley\", \"Brass\", \"Whisper\", \"Ledger\"],\n },\n \"Basement Prince\": {\n \"flavor\": \"royal delusion wrapped in dust, snacks, and old cables\",\n \"noun_pool\": [\"Basement\" ..."}, {"id": "build-small-hackathon/gitopadesh", "slug": "gitopadesh", "title": "Gitopadesh", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# GITOPADESH — The Bhagavad Gita as a Living Advisor ## What Is This? **GITOPADESH** is a Bhagavad Gita life advisor powered by Qwen2.5-7B-Instruct. You speak your real dilemma—career confusion, relationship struggles, fear, purpose—and **Lord Krishna himself responds in first person**, citing the exact Chapter and Verse from the Gita that applies to your situation. Not generic wisdom. Not life coach platitudes. The actual teachings of the Bhagavad Gita, applied to your modern struggle, delivered in Krishna's voice. ## How It Works 1. Type your dilemma into the sacred input field 2. Click **Seek Guidance** 3. Krishna responds—calm, profound, actionable—with the exact Gita verse that illuminates your path **Streaming responses** ensure you watch his wisdom appear in real time, like a revelation unfolding. ## The Prompt Engineering The system prompt instructs the model to **always**: - Address you as \"Arjuna\" (representing every seeker) - Acknowledge your struggle with compassion - Cite the specific Chapter:Verse (e.g., \"Chapter 2, Verse 47\") - Quote the Sanskrit first, then translate and apply it - End with an empowering reminder of your divine nature This guarantees Krishna never breaks character, never sounds like an AI, and never gives generic advice. ## Core Teachings Woven In - **Nishkama Karma** (Ch. 2:47) — Act without attachment to results - **Svadharma** (Ch. 3:35) — Follow your own path, not another's - **Equanimity** (Ch. 2:14) — Pain and pleasure are temporary - ** ...", "app": "from huggingface_hub import InferenceClient\nfrom bhagavad_gita import format_verse_for_prompt, GITA_CHAPTERS\nfrom PIL import Image, ImageDraw, ImageFont\nfrom io import BytesIO\nfrom sentence_transformers import SentenceTransformer\n\nimport gradio as gr\nfrom huggingface_hub import InferenceClient\nimport os\nimport json\nimport numpy as np\nfrom bhagavad_gita import format_verse_for_prompt, GITA_CHAPTERS\nfrom PIL import Image, ImageDraw, ImageFont\nimport math\nimport base64\nfrom io import BytesIO\n\n# Browser-native TTS via JavaScript - no server delay, streams with text\nHAS_VOICE = True # Always true - voice handled client-side\n\n# ════════════════════════════════════════════════════════════════\n# MULTILINGUAL SUPPORT\n# ════════════════════════════════════════════════════════════════\n\nTRANSLATIONS = {\n \"en\": {\n \"title\": \"GITOPADESH\",\n \"subtitle\": \"Speak your struggle. Receive the wisdom of eternity.\",\n \"dilemma_label\": \"Your Dilemma, O Seeker\",\n \"dilemma_placeholder\": \"O Krishna, I am troubled by...\",\n \"choose_struggle\": \"Or choose a common struggle:\",\n \"seek_button\": \"✦ SEEK KRISHNA'S GUIDANCE ✦\",\n \"krishna_speaks\": \"Krishna Speaks\",\n \"emotion_label\": \"Arjuna's Emotion:\",\n \"chapter_map\": \"Battlefield Map — Chapters Invoked\",\n \"journey\": \"Your Battlefield Journey\",\n \"shloka_card\": \"📿 Your Shloka Card — Download & Share\",\n \"language\": \"Language\"\n },\n \"hi\": {\n \"title\": \"गीतोपदेश\",\n \"subtitle\": \"अपना संघर्ष बताएं। शाश्वत ज्ञान प्राप्त करें।\",\n \"dilemma_label\": \"आपकी समस्या, हे सन्निहित\",\n \"dilemma_placeholder\": \"हे कृष्ण, मैं परेशान हूँ...\",\n \"choose_struggle\": \"या एक सामान्य संघर्ष चुनें:\",\n \"seek_button\": \"✦ कृष्ण का मार्गदर्शन प्राप्त करें ✦\",\n \"krishna_speaks\": \"कृष्ण बोलते हैं\",\n \"emotion_label\": \"अर्जुन की भावना:\", ..."}, {"id": "build-small-hackathon/roadb-other-screen", "slug": "roadb-other-screen", "title": "Road B: The Other Screen", "sdk": "gradio", "models": ["unsloth/Qwen3.5-9B-GGUF"], "tags": ["build-small-hackathon", "custom-frontend", "gguf", "gradio", "gradio-server", "interactive-fiction", "llama-cpp", "modal", "qwen", "small-models"], "app_file": "app.py", "structural_profile": "both", "readme": "# Road B: The Other Screen **Talk to a fictional version of yourself who chose differently.** Road B is a small-model interactive fiction experience for the Build Small Hackathon, Chapter Two: **An Adventure in Thousand Token Wood**. You name a fork in your life. The app opens a cinematic **Other Screen** and lets you speak with a fictional alternate self: the version of you who took Road B. It is not prediction, therapy, or advice. It is a strange mirror. ## What the app does Road B turns a life fork into a limited-signal ritual. The user can: - describe a decision point - invoke a fictional Road B self - chat with that alternate self - collect Echo Artifacts - unlock a Final Transmission - download a souvenir card from the road not taken - export a synthetic-style trace of the interaction The core loop is: ```text Name the fork → Tune the Other Screen → Meet Road B → Collect Echo Artifacts → Unlock Final Transmission → Save the Souvenir Card ``` ## Echo Artifacts Road B is not just a chat app. After the first transmission, the user can collect artifacts from the alternate life: - **Cost Ledger** - **Beauty Ledger** - **A Typical Tuesday** - **The Unsent Letter** - **The Moment It Split** After three Echo Artifacts, the **Final Transmission** unlocks. ## Runtime Road B is hosted as a Hugging Face Gradio Space. The Hugging Face Space handles: - custom cinematic UI - Gradio app shell - Road B session state - Echo Artifacts game loop - souvenir card rendering - trace export - p ...", "app": "from __future__ import annotations\nfrom functools import lru_cache\nfrom pathlib import Path\nfrom typing import Any, Dict, List, Optional\nfrom gradio import Server # type: ignore[attr-defined]\nfrom fastapi.responses import HTMLResponse, JSONResponse\nfrom fastapi.staticfiles import StaticFiles\nfrom llama_cpp import Llama\n\n\"\"\"Road B: The Other Screen - hackathon-ready Gradio Server app.\n\nCustom frontend: index.html\nModel runtime: Qwen GGUF through llama.cpp via llama-cpp-python\nNo mock fallback: if the model/runtime cannot load, the app returns a visible error.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport ctypes\nimport datetime as dt\nimport glob\nimport html\nimport json\nimport os\nimport re\nimport requests\nimport site\nimport threading\nimport uuid\nfrom functools import lru_cache\nfrom pathlib import Path\nfrom typing import Any, Dict, List, Optional\n\ntry:\n import gradio as gr\nexcept Exception: # pragma: no cover\n gr = None # type: ignore[assignment]\n\ntry:\n from gradio import Server # type: ignore[attr-defined]\nexcept Exception: # pragma: no cover\n Server = None # type: ignore[assignment]\n\ntry:\n from fastapi.responses import HTMLResponse, JSONResponse\n from fastapi.staticfiles import StaticFiles\nexcept Exception: # pragma: no cover\n HTMLResponse = None # type: ignore[assignment]\n JSONResponse = None # type: ignore[assignment]\n StaticFiles = None # type: ignore[assignment]\n\n\n# -----------------------------------------------------------------------------\n# CUDA library preparation for pip-installed NVIDIA runtime packages\n# -----------------------------------------------------------------------------\n\n\ndef _candidate_site_dirs() -> List[Path]:\n dirs: List[Path] = []\n try:\n dirs.extend(Path(p) for p in site.getsitepackages())\n except Exception:\n pass\n try:\n dirs.append(Path(site.getusersitepackages()))\n e ..."}, {"id": "build-small-hackathon/dreamwall-mc", "slug": "dreamwall-mc", "title": "DreamWall MC", "sdk": "gradio", "models": [], "tags": ["agent-trace", "art", "codex", "game", "gradio", "minecraft", "small-models"], "app_file": "app.py", "structural_profile": "both", "readme": "# DreamWall MC DreamWall MC is a Minecraft-native AI art wall for the Build Small Hackathon. Players can hatch a NeuroPet from a prompt, then carve the creature's memory into the DreamWall. A tiny local semantic fingerprint engine turns player language into creature traits, survival odds, plot placement, Minecraft packets, and public artifacts. The fun part is drift: tiny wording changes and different player names visibly change the painting. Nearby prompts can fuse into shared concepts, and each plot gets a demo value based on density, adjacency, rarity, and votes. The wall acts like a shared server memory rather than a normal image generator. ## Why This Is Different Most hackathon apps stop at chat or image generation. DreamWall MC turns language into a shared place. - **Minecraft-native:** the output is a wall packet, block palette, and row-run placement plan, not just a picture. - **Creature-native:** prompts hatch named pets with survival odds, lineage, and server state. - **Identity-aware:** the same prompt changes when the player signature or gallery zone changes. - **Social artifact:** every prompt becomes part of a public server museum. - **Creative fusion:** nearby concepts combine into more valuable artifacts. - **Value without compliance risk:** auction/voting uses demo points, not real money or blockchain. - **Small by design:** no giant remote model API is required for the core experience. - **Demo-first:** the video can show prompt -> Space preview -> Minecraf ...", "app": "from dataclasses import dataclass\nfrom PIL import Image, ImageDraw\n\nimport hashlib\nimport json\nimport math\nimport os\nfrom dataclasses import dataclass\n\nimport gradio as gr\nimport numpy as np\nfrom PIL import Image, ImageDraw\n\n\nMODEL_ID = \"dreamwall-local-semantic-fingerprint-v1\"\nGRID = 32\nSCALE = 12\n\n\nBLOCKS = [\n (\"white_wool\", (234, 236, 230)),\n (\"black_wool\", (25, 25, 25)),\n (\"gray_wool\", (78, 82, 86)),\n (\"light_gray_wool\", (156, 160, 162)),\n (\"brown_wool\", (114, 73, 43)),\n (\"red_wool\", (160, 39, 34)),\n (\"orange_wool\", (230, 118, 31)),\n (\"yellow_wool\", (246, 198, 45)),\n (\"lime_wool\", (96, 187, 50)),\n (\"green_wool\", (74, 124, 42)),\n (\"cyan_wool\", (22, 156, 156)),\n (\"light_blue_wool\", (92, 168, 224)),\n (\"blue_wool\", (53, 70, 164)),\n (\"purple_wool\", (126, 61, 181)),\n (\"magenta_wool\", (190, 67, 181)),\n (\"pink_wool\", (239, 141, 172)),\n (\"sandstone\", (218, 203, 143)),\n (\"moss_block\", (89, 110, 45)),\n (\"deepslate\", (62, 62, 68)),\n (\"amethyst_block\", (133, 89, 184)),\n (\"prismarine\", (99, 156, 151)),\n (\"glowstone\", (241, 203, 118)),\n (\"obsidian\", (28, 22, 38)),\n (\"sea_lantern\", (172, 205, 190)),\n]\n\nMOOD_WORDS = {\n \"cozy\": [\"cozy\", \"warm\", \"cottage\", \"soft\", \"home\", \"lantern\"],\n \"cursed\": [\"cursed\", \"haunted\", \"eldritch\", \"broken\", \"void\", \"forbidden\"],\n \"ancient\": [\"ancient\", \"ruin\", \"temple\", \"fossil\", \"myth\", \"buried\"],\n \"mechanical\": [\"machine\", \"gear\", \"factory\", \"robot\", \"engine\", \"circuit\"],\n \"wild\": [\"forest\", \"storm\", \"moss\", \"ocean\", \"swamp\", \"wind\"],\n \"royal\": [\"castle\", \"king\", \"queen\", \"gold\", \"throne\", \"banner\"],\n}\n\nCANVAS_SIZE = 12\nPLOT_SCALE = 32\nEXISTING_ARTWORKS = [\n {\n \"title\": \"Bird above the broken sky\",\n \"player\": \"anonymous_heron\",\n \"prompt\": \"a bird in the sky over a silver tree\",\n \"x\": 4,\n \"z\": 5,\n \"moods\": [\"wild\", \"co ..."}, {"id": "build-small-hackathon/persona-atlas", "slug": "persona-atlas", "title": "Persona Atlas", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# Persona Atlas **Put Socrates, Churchill, and Sam Altman in the same room, ask them the same unanswerable question, and watch whose mind leans which way.** Persona Atlas is a small experiment in *behavioral* portraits. Instead of asking \"what did this person do,\" it asks \"how does this person *think*\" — and then lets you line several thinkers up side by side and actually see the difference. You give it a name. An LLM agent goes and researches that person on the open web, writes a grounded dossier, then answers a fixed set of open-ended philosophy prompts *in that persona's voice*. Every answer is turned into an embedding, so personas stop being prose and become points you can measure, map, and compare. ## Researching a mind Type a name, hit run, and the agent gets to work: it runs web searches, pulls a portrait, and assembles a public profile, a list of grounded facts, and a *style hypothesis* — its best guess at how this person attacks a brand-new problem. The portrait is downloaded and stored with the run, and every claim links back to a real source the agent actually visited.  Then the same persona answers the benchmark — ten \"на подумать\" questions about identity, ethics, truth, free will, meaning, and machine consciousness. There are no right answers on purpose: these are the prompts where a personality actually shows through, rathe ...", "app": "from concurrent.futures import ThreadPoolExecutor, as_completed\nfrom datetime import datetime\nfrom html import escape\nfrom pathlib import Path\nfrom urllib.parse import urlparse\nfrom huggingface_hub import InferenceClient\nfrom umap import UMAP\nfrom ddgs import DDGS\n\nimport base64\nimport json\nimport os\nimport re\nimport time\nimport uuid\nfrom concurrent.futures import ThreadPoolExecutor, as_completed\nfrom datetime import datetime\nfrom html import escape\nfrom pathlib import Path\nfrom urllib.parse import urlparse\n\nimport gradio as gr\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd\nimport requests\nfrom huggingface_hub import InferenceClient\nfrom umap import UMAP\n\n\ndef load_env_file():\n path = Path(\".env\")\n if not path.exists():\n return\n for line in path.read_text(encoding=\"utf-8\").splitlines():\n line = line.strip()\n if not line or line.startswith(\"#\") or \"=\" not in line:\n continue\n key, value = line.split(\"=\", 1)\n key = key.strip()\n value = value.strip().strip('\"').strip(\"'\")\n if key and key not in os.environ:\n os.environ[key] = value\n\n\nload_env_file()\n\nGENERATION_MODEL = os.environ.get(\"GENERATION_MODEL\", \"google/gemma-4-26B-A4B-it\")\nGENERATION_PROVIDER = os.environ.get(\"GENERATION_PROVIDER\", \"novita\")\nEMBEDDING_MODEL = os.environ.get(\"EMBEDDING_MODEL\", \"microsoft/harrier-oss-v1-0.6b\")\nEMBEDDING_PROVIDER = os.environ.get(\"EMBEDDING_PROVIDER\", \"hf-inference\")\nSAMPLING_TEMPERATURE = 1.0\nSAMPLING_TOP_P = 0.95\nSAMPLING_TOP_K = 64\nGENERATION_WORKERS = 4\nEMBEDDING_WORKERS = 4\nUI_CONCURRENCY = 4\nBROWSER_SEARCH_RESULTS = 5\nRESEARCH_AGENT_VERSION = \"gemma-browser-search-v1\"\nMIN_RESEARCH_SOURCES = 5\nDATA_DIR = Path(\"data/personas\")\nARTIFACT_DIR = Path(\"artifacts\")\nIMAGE_DIR = Path(\"data/images\")\nANCHOR_DIR = Path(\"data/anchors\")\nBENCHMARK_PATH = Path(\"data/benchmark.json\")\n\ndef load ..."}, {"id": "build-small-hackathon/ContextForge", "slug": "ContextForge", "title": "ContextForge", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# ContextForge / Agent Prompt Compiler ContextForge compiles messy software, app, and agent ideas into executable prompt architectures. It is a compiler pipeline, not a generic prompt generator. **GitHub:** https://github.com/rthgit/ContextForge **Competition Gradio Space:** https://huggingface.co/spaces/build-small-hackathon/ContextForge **Backup Gradio Space:** https://huggingface.co/spaces/RthItalia/ContextForge **Demo video:** https://raw.githubusercontent.com/rthgit/ContextForge/main/artifacts/contextforge-demo.mp4 **Tagline:** From fuzzy brief to build-ready agent blueprint. ## Backyard AI Fit - Built for real builders using AI coding agents. - Real problem: vague briefs make Codex and other agents produce wrong code, generic UI, or incomplete workflows. - Real use evidence: this architecture was used to coordinate Trollsona development, including UI refactor, model cascade, QA, packaging, and video automation. - Small-model fit: ContextForge decomposes a hard prompt-writing task into seven smaller calls so a small model can handle it. The backend always executes seven isolated modules sequentially: 1. intake analysis 2. topology decision 3. Vital Few / Vital Spot extraction 4. reasoning architecture selection 5. prompt pack generation 6. QA / repair 7. final assembly Every module attempts its own small-model call. If one call fails, only that stage uses a deterministic fallback and the pipeline continues. Runtime Details shows the source used by every stage. Each modul ...", "app": "from __future__ import annotations\nfrom dataclasses import dataclass\nfrom functools import lru_cache\nfrom typing import Any, Callable\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\nfrom __future__ import annotations\n\nimport json\nimport os\nimport re\nimport time\nfrom dataclasses import dataclass\nfrom functools import lru_cache\nfrom typing import Any, Callable\n\n\nAPP_TITLE = \"ContextForge\"\nAPP_SUBTITLE = \"From fuzzy brief to build-ready agent blueprint.\"\nDEFAULT_MODEL_ID = \"Qwen/Qwen2.5-0.5B-Instruct\"\nDEFAULT_MID_MODEL_ID = \"RthItalia/nano_compact_3b_qkvfp16\"\nDEFAULT_HIGH_MODEL_ID = \"Qwen/Qwen3-32B\"\nREQUIRED_PROMPT_TAGS = [\n \"ROLE\",\n \"COGNITIVE_LAYERS\",\n \"KAHNEMAN_SYSTEM2\",\n \"PARETO_80_20\",\n \"VITAL_SPOT\",\n \"REASONING_PROTOCOL\",\n \"AGENTIC_LOOP\",\n \"ACTION\",\n \"FORMAT_AND_TARGET\",\n \"QA_CHECKS\",\n]\nTOPOLOGIES = [\"Auto\", \"Single Prompt\", \"Cascade\", \"Context Pack\", \"Agent Workflow\"]\nREASONING_LAYERS = [\n \"CRAFT\",\n \"Kahneman System 2\",\n \"Pareto 80/20\",\n \"Agentic Loop\",\n \"Tree of Thought controlled\",\n \"Private CoT\",\n \"Self-Correction\",\n \"Sentinel Recovery\",\n]\nSTAGE_NAMES = [\n \"intake_analysis\",\n \"topology_decision\",\n \"vital_structure\",\n \"reasoning_architecture\",\n \"prompt_pack_generation\",\n \"qa_repair\",\n \"final_assembly\",\n]\nSTAGE_TOKEN_BUDGETS = {\n \"intake_analysis\": 180,\n \"topology_decision\": 140,\n \"vital_structure\": 180,\n \"reasoning_architecture\": 240,\n \"prompt_pack_generation\": 520,\n \"qa_repair\": 260,\n \"final_assembly\": 260,\n}\n\n\ndef parse_bool_env(name: str, default: bool = False) -> bool:\n raw = os.getenv(name)\n if raw is None:\n return default\n return raw.strip().lower() in {\"1\", \"true\", \"yes\", \"on\"}\n\n\ndef parse_int_env(name: str, default: int, minimum: int, maximum: int) -> int:\n try:\n value = int(os.getenv(name, str(default)))\n except Valu ..."}, {"id": "build-small-hackathon/lovegpt", "slug": "lovegpt", "title": "loveGPT", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# loveGPT Premium AI dating platform powered by OpenClaw. ## Structure - `frontend/` Flutter app for web, Android, and iOS. - `backend/` Node.js, TypeScript, Express, Supabase, Stripe, AI, embeddings. - `backend/supabase/migrations/` PostgreSQL schema, RLS, pgvector matching RPC. - `shared/` full compatibility questionnaire and shared TypeScript contracts. - `artifacts/` OpenClaw prompt and response schema. - `docs/` setup, API, and deployment notes. - `app.py` Gradio/Hugging Face Space adapter. - `training/` privacy-preserving matchmaker model training pipeline. ## Gradio Space ```powershell python -m pip install -r requirements.txt python app.py ``` The Space adapter runs session-local by default and does not require Supabase or Stripe secrets just to launch. Profile exports are encrypted JSONL rows, and questionnaire turns are logged into an encrypted matchmaker-only table. Set `DATACLAW_PROFILE_KEY` and `MATCHMAKER_TABLE_KEY` as Hugging Face secrets when rows must remain decryptable by Dataclaw and the matchmaker across restarts. Optional local Phi OpenClaw runtime: ```powershell llama-server ` -hf ysn-rfd/Phi-4-mini-instruct-GGUF:Q4_0 ` --alias microsoft/Phi-4-mini-instruct ` --jinja ` --host 127.0.0.1 ` --port 8081 ` -c 32768 $env:OPENCLAW_PROVIDER=\"local\" $env:OPENCLAW_LOCAL_MODEL=\"microsoft/Phi-4-mini-instruct\" $env:OPENCLAW_LOCAL_BASE_URL=\"http://127.0.0.1:8081/v1\" python app.py ``` Dataclaw-only decrypt: ```powershell $env:DATACLAW_PROFILE_KEY=\"your-secret\" $env:DAT ...", "app": "from __future__ import annotations\nfrom dataclasses import dataclass\nfrom datetime import datetime, timedelta, timezone\nfrom pathlib import Path\nfrom typing import Any\nfrom cryptography.hazmat.primitives.ciphers.aead import AESGCM\nfrom huggingface_hub import HfApi\n\nfrom __future__ import annotations\n\nimport base64\nimport hashlib\nimport hmac\nimport json\nimport math\nimport os\nimport re\nimport secrets\nimport tempfile\nimport threading\nimport urllib.error\nimport urllib.request\nimport uuid\nfrom dataclasses import dataclass\nfrom datetime import datetime, timedelta, timezone\nfrom pathlib import Path\nfrom typing import Any\n\nimport gradio as gr\nfrom cryptography.hazmat.primitives.ciphers.aead import AESGCM\nfrom huggingface_hub import HfApi\n\n\nROOT = Path(__file__).resolve().parent\nQUESTIONS_PATH = ROOT / \"shared\" / \"questions.json\"\nHERO_IMAGE_PATH = ROOT / \"assets\" / \"lovegpt-lounge.png\"\nEXPECTED_QUESTIONS = int(os.getenv(\"OPENDB_EXPECTED_QUESTIONS\", \"0\"))\nBRAND_NAME = \"loveGPT\"\nVAULT_SCHEMA = \"opendatebase.profile.vault.v1\"\nMATCHMAKER_TABLE_SCHEMA = \"opendatebase.matchmaker.table.v1\"\nMATCHMAKER_TABLE_PATH = Path(os.getenv(\"MATCHMAKER_TABLE_PATH\", str(Path(tempfile.gettempdir()) / \"lovegpt-matchmaker-table.jsonl.enc\")))\nSPEED_DATE_SECONDS = int(os.getenv(\"SPEED_DATE_SECONDS\", \"1200\"))\nOPENCLAW_PROVIDER = os.getenv(\"OPENCLAW_PROVIDER\", os.getenv(\"AI_PROVIDER\", \"deterministic\")).strip().lower()\nOPENCLAW_LOCAL_BASE_URL = os.getenv(\"OPENCLAW_LOCAL_BASE_URL\", os.getenv(\"LOCAL_AI_BASE_URL\", \"http://127.0.0.1:8081/v1\")).rstrip(\"/\")\nOPENCLAW_LOCAL_MODEL = os.getenv(\"OPENCLAW_LOCAL_MODEL\", os.getenv(\"AI_MODEL\", \"microsoft/Phi-4-mini-instruct\"))\nOPENCLAW_LOCAL_API_KEY = os.getenv(\"OPENCLAW_LOCAL_API_KEY\", os.getenv(\"LOCAL_AI_API_KEY\", \"\")).strip()\nOPENCLAW_FALLBACK_DETERMINISTIC = os.getenv(\"OPENCLAW_FALLBACK_DETERMINISTIC\", \"1\").strip().lower() not in {\"0\", \"false\", \"no\"}\n_SESSION_PROFIL ..."}, {"id": "build-small-hackathon/her", "slug": "her", "title": "Her · हेर", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "
Her · हेर
हेर — Marathi for “detective.”
A detective for your coding-agent sessions. Drop a Claude Code session export and Her reads the whole trace — so you can see what actually happened, and what to do better next time.
--- ## What this Space does Upload your Claude Code session exports (`.jsonl`) and Her investigates them: - **The journey.** Every query as a node, sized by cost, the heaviest glowing — with a plain-English **“what happened”** on top and the deterministic cost-shape below. - **The dataflow.** The tool calls along each turn, with the **proven value-flow** path highlighted on focus (a value that reappeared *verbatim* from an earlier result) — proven (solid) vs. hypothesis (dotted), always kept separate. - **Risky moves, surfaced.** Deploys, production & config changes, secrets — the actions worth a second look, each traceable to the turn it happened in. - **What to do better.** Tips grounded in Anthropic’s and the community’s best practices. Her **suggests, never asserts** — and stays s ...", "app": "from __future__ import annotations\nfrom pathlib import Path\nfrom fastapi import File, Form, Header, UploadFile # noqa: E402\nfrom fastapi.responses import FileResponse, JSONResponse # noqa: E402\nfrom fastapi.staticfiles import StaticFiles # noqa: E402\n\n#!/usr/bin/env python3\n\"\"\"Her · हेर — Hugging Face ZeroGPU Space entrypoint (Gradio Server mode).\n\nZeroGPU is Gradio-SDK-only and its GPU quota requires the HF iframe auth headers to\nbe forwarded on GPU-invoking calls — a plain `fetch` to a custom route that triggers\n`@spaces.GPU` bypasses that and fails. So this app uses **Gradio Server mode**\n(`gradio.Server`, a FastAPI server with Gradio's API engine):\n\n * DETERMINISTIC engine endpoints (no GPU) are plain FastAPI routes the React app\n calls with `fetch`:\n GET /api/health GET /api/sessions\n POST /api/upload GET /api/analyze?path=\n GET /api/project?cwd= POST /api/clear GET/POST /api/consent\n * GPU narration endpoints are Gradio API endpoints (`@app.api`) the browser calls\n via `@gradio/client` (which forwards the auth headers ZeroGPU needs):\n overview · advice · chat · project_chat · project_narrative\n\nSTORAGE & PRIVACY (the hosted Space):\n * Uploaded sessions are stored on an HF **storage bucket** mounted read-write at\n `HER_DATA_DIR` (`/data`), namespaced per client: `/data///.jsonl`\n where `ns = sha256(client-token)`. The client token is generated in the browser\n (localStorage) and sent as the `X-Her-Client` header (REST) / `client` arg (Gradio),\n so every user only ever SEES and ANALYZES their own sessions — public-safe.\n * Trace content is auto-deleted: a background sweeper removes anything older than\n `HER_RETENTION_HOURS` (24h) — the hard guarantee — and `POST /api/clear` wipes the\n caller's namespace immediately (the UI calls it on a \"Clear\" click an ..."}, {"id": "build-small-hackathon/ux-crime-scene", "slug": "ux-crime-scene", "title": "UX Crime Scene", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# 🔎 UX Crime Scene ### *Every interface hides a crime.* [](https://youtu.be/q0eVojmhICQ) ▶️ Watch the trailer
Drop a screenshot of **any** website or app. **THE INSPECTOR** — a hard-boiled, film-noir detective — works the scene, circles every UX flaw as evidence, and files a verdict with a letter grade. It's a UX audit that plays like a detective thriller. --- ## ▶️ The Trailer **[▶️ Watch the trailer on YouTube](https://youtu.be/q0eVojmhICQ)** — the case file, on film. --- ## 🕵️ How to use it 1. **Drop the evidence** — a UI screenshot onto the detective's desk. 2. **Watch The Inspector investigate** — the scene gets worked, live. 3. **Read the case file** — every *\"crime against the user\"* circled on the image, each charge explained, with a final **verdict and grade**. 4. **Share the case** — every investigation gets a unique, shareable link. > 💡 Best experienced on **desktop, with sound on**. 🎧 --- ## 🔫 The crimes it catches - Weak or confusing calls-to-action - Buried, hidden, or unreachable actions - Visual overload & broken hierarchy - Dark patterns & ambiguous labels - …and whatever else is hiding in plain sight Every charge points to a **real element on the screen** — coordinates grounded by the vision model, not guessed. --- ## 🧠 Under the hood | | | | --- | --- | | 👁️ **Vision** | `Qwen2.5-VL-32B-Instruct` on **Modal** (vLLM, A100-80GB, scal ...", "app": "from __future__ import annotations\nfrom pathlib import Path\nfrom PIL import Image\nfrom annotate import annotate\nfrom detective import CaseFile, investigate_agentic, save_case, fetch_case\n\n\"\"\"\nUX Crime Scene — Gradio frontend (real 3-step wizard).\n\nLocal dev:\n export MODAL_ENDPOINT_URL=\"https://--ux-crime-scene-qwen-web.modal.run\"\n python app.py\n\"\"\"\n\nfrom __future__ import annotations\n\nimport base64\nimport html\nimport io\nimport os\nimport time\nimport traceback\nimport urllib.parse\nfrom pathlib import Path\n\nimport gradio as gr\nfrom PIL import Image\n\nfrom annotate import annotate\nfrom detective import CaseFile, investigate_agentic, save_case, fetch_case\n\nHERE = Path(__file__).parent\nASSETS = HERE / \"assets\"\n\n# Public URL of the tool (set this to the Space URL in production).\nTOOL_URL = os.environ.get(\"PUBLIC_URL\", \"\").strip() or \\\n \"https://huggingface.co/spaces/build-small-hackathon/ux-crime-scene\"\n\nASSET_VARS = {\n \"paper.jpg\": \"--asset-paper\",\n \"emblem.png\": \"--asset-emblem\",\n \"magnifier.png\": \"--asset-magnifier\",\n \"grade_seal.png\": \"--asset-grade\",\n \"stamp_confidential.png\": \"--asset-stamp-confidential\",\n \"stamp_guilty.png\": \"--asset-stamp-guilty\",\n \"desk_topdown.jpg\": \"--asset-desk\",\n}\n_MIME = {\".png\": \"image/png\", \".jpg\": \"image/jpeg\", \".jpeg\": \"image/jpeg\"}\n\nSTATIC_CSS = (HERE / \"styles.css\").read_text(encoding=\"utf-8\")\n\n\ndef esc(v) -> str:\n return html.escape(str(v))\n\n\ndef _build_asset_style() -> tuple[str, dict[str, bool]]:\n overrides, present = [], {}\n for fname, var in ASSET_VARS.items():\n path = ASSETS / fname\n ok = path.exists()\n present[fname] = ok\n if ok:\n raw = path.read_bytes()\n mime = _MIME.get(path.suffix.lower(), \"image/png\")\n b64 = base64.b64encode(raw).decode(\"ascii\")\n overrides.append(f\"{var}: url('data:{mime};base64,{b64}');\")\n if p ..."}, {"id": "build-small-hackathon/Tone-Bridge", "slug": "Tone-Bridge", "title": "ToneBridge", "sdk": "gradio", "models": ["Qwen/Qwen3-14B", "Qwen/Qwen3-TTS-12Hz-0.6B-CustomVoice"], "tags": ["build-small-hackathon", "chinese", "gradio-server", "grammar-correction", "language-learning", "mandarin", "off-brand", "pinyin", "text-to-speech", "zerogpu"], "app_file": "app.py", "structural_profile": "both", "readme": "# ToneBridge — a gentle Mandarin sentence coach > *Build natural Mandarin sentences, one small correction at a time.* Built for the Hugging Face **Build Small Hackathon 2026** --- ## The Problem Beginner Mandarin learners often know what they want to say, but not whether the sentence sounds natural, polite, or appropriate for the social context. Classic translators tend to rewrite too much. Grammar tools often explain too much. A beginner needs something narrower: keep my meaning, fix only what is needed, show the pinyin, and tell me why in plain English. **ToneBridge is built for that moment.** You choose a context, choose a tone, write or speak one Chinese sentence, and get a small, practical correction designed for learning rather than translation. ## What it does ToneBridge returns: - one corrected Mandarin sentence; - pinyin with tone marks under Chinese text; - a short error type; - a concise explanation in English; - a practical tip for next time; - a natural Mandarin reading voice with a follow-along reading view. The correction prompt is intentionally conservative: if the sentence is already correct and natural, the corrected sentence should remain unchanged. ## How it works 1. The learner selects a context: **Friends**, **Family**, **Work**, or **WeChat**. 2. The learner selects the intended tone. 3. They type a Chinese sentence, or use browser speech recognition. 4. Qwen corrects the sentence while preserving the learner's meaning and length. 5. The frontend adds p ...", "app": "from typing import Optional\nfrom fastapi.responses import HTMLResponse\nfrom pypinyin import Style, lazy_pinyin\nfrom transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig\nfrom qwen_tts import Qwen3TTSModel\n\nimport gc\nimport base64\nimport io\nimport os\nimport re\nfrom typing import Optional\n\nimport gradio as gr\nimport numpy as np\nimport torch\nfrom fastapi.responses import HTMLResponse\nfrom pypinyin import Style, lazy_pinyin\nfrom transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig\n\ntry:\n import spaces\nexcept Exception:\n class _SpacesFallback:\n @staticmethod\n def GPU(*args, **kwargs):\n def decorator(fn):\n return fn\n return decorator\n\n spaces = _SpacesFallback()\n\n\nDEFAULT_MODEL_ID = \"Qwen/Qwen3-14B\"\nMODEL_ID = os.getenv(\"MODEL_ID\", DEFAULT_MODEL_ID).strip() or DEFAULT_MODEL_ID\nDEFAULT_TTS_MODEL_ID = \"Qwen/Qwen3-TTS-12Hz-0.6B-CustomVoice\"\nTTS_MODEL_ID = os.getenv(\"TTS_MODEL_ID\", DEFAULT_TTS_MODEL_ID).strip() or DEFAULT_TTS_MODEL_ID\nENABLE_SERVER_TTS = os.getenv(\"ENABLE_SERVER_TTS\", \"true\").strip().lower() in {\"1\", \"true\", \"yes\", \"y\"}\nTTS_MAX_CHARS = int(os.getenv(\"TTS_MAX_CHARS\", \"180\"))\nMAX_INPUT_CHARS = int(os.getenv(\"MAX_INPUT_CHARS\", \"1200\"))\nMAX_NEW_TOKENS = int(os.getenv(\"MAX_NEW_TOKENS\", \"220\"))\nLOAD_IN_4BIT = os.getenv(\"LOAD_IN_4BIT\", \"true\").strip().lower() in {\"1\", \"true\", \"yes\", \"y\"}\nPRELOAD_MODEL = os.getenv(\"PRELOAD_MODEL\", \"true\").strip().lower() in {\"1\", \"true\", \"yes\", \"y\"}\n\ntokenizer = None\nmodel = None\nload_error: Optional[str] = None\ntts_model = None\ntts_load_error: Optional[str] = None\napp = gr.Server()\n\n\nSYSTEM_PROMPT = \"\"\"You are a Mandarin Chinese teacher for beginner learners.\n\nYour task is to correct ONE student Chinese sentence according to the selected context and tone.\nYour default behavior is conservative minimal correction.\n\nDo not create a ri ..."}, {"id": "build-small-hackathon/family-care-network", "slug": "family-care-network", "title": "Adwuma Pa", "sdk": "gradio", "models": ["facebook/mms-1b-all", "ninte/twi-en-nllb-v2", "Qwen/Qwen2.5-7B-Instruct", "facebook/mms-tts-aka", "facebook/mms-tts-eng", "teckedd/whisper_small-waxal_akan-asr-v1", "GiftMark/akan-whisper-model"], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# Adwuma Pa Adwuma Pa is a small-model family care network for Ghanaian elders. It creates real checkup requests, collects text or voice responses in Twi, Fante, or English, translates Akan-family responses to English, analyzes concern with Qwen, routes follow-up to nearby relatives, and gives the family coordinator a live Gradio dashboard. Built for the Build Small Hackathon, Backyard AI track. ## Built With OpenAI Codex OpenAI Codex is being used as the coding agent for this build. Codex created and patched the ASR eval Space, the main family care Space, SQLite persistence, configurable silence escalation, and the community voting workflow. See `CODEX_BUILD_LOG.md` and `HACKATHON_TODO.md`. ## Why This Should Be Competitive - Specific real user: a Ghanaian family coordinator checking on elders across cities. - Small-model compliant: ASR, concern scoring, and TTS are each under the 32B parameter cap. - Real workflow: tokenized checkup requests, silence detection, first-party relay, alerts, and loop closure. - Bonus badges targeted: custom Gradio UI, field notes, published fine-tuned Akan ASR model, and shared build trace. - OpenAI track angle: Codex-assisted build process, documented agent trace, and a practical agentic care workflow where the AI routes work to the right human. ## Run Locally ```bash python -m venv .venv source .venv/bin/activate pip install -r requirements.txt python app.py ``` Then open the local Gradio URL. ## Hugging Face Space Use the main app Space: ``` ...", "app": "from __future__ import annotations\nfrom config.models import ASR_CONFIG, LLM_CONFIG, TRANSLATION_CONFIG, TTS_CONFIG, total_parameter_budget_b\nfrom db import database as db\nfrom services.relay import dashboard_rows, scan_silence, simulate_nudge\nfrom services import modal_client, pipeline\n\nfrom __future__ import annotations\n\nimport json\n\nimport gradio as gr\n\nfrom config.models import ASR_CONFIG, LLM_CONFIG, TRANSLATION_CONFIG, TTS_CONFIG, total_parameter_budget_b\nfrom db import database as db\nfrom services.relay import dashboard_rows, scan_silence, simulate_nudge\nfrom services import modal_client, pipeline\n\nFAMILY_HEADERS = [\n \"Name\",\n \"City\",\n \"Region\",\n \"Language\",\n \"Status\",\n \"Concern\",\n \"Minutes silent\",\n \"Reminder min\",\n \"Amber min\",\n \"Red min\",\n \"Last summary\",\n \"Analysis\",\n \"Next action\",\n \"Token\",\n]\nALERT_HEADERS = [\"Alert\", \"Member\", \"Type\", \"Created\", \"State\", \"Notes\"]\nOPEN_LOOP_HEADERS = [\"Member\", \"Type\", \"Created\", \"Notes\"]\nCHECKIN_HEADERS = [\"Submitted\", \"Source\", \"Input\", \"Status\", \"Concern\", \"Summary\", \"Translation\", \"Transcript\", \"Error\"]\nREQUEST_HEADERS = [\"Request\", \"Token\", \"Member\", \"Type\", \"Reason\", \"Priority\", \"Status\", \"Created\", \"Completed\"]\nNUDGE_HEADERS = [\"Sent\", \"Contact\", \"Request\", \"Responded\", \"Check-in\"]\nAFFILIATION_HEADERS = [\"Subject\", \"Related\", \"Relationship\", \"Care role\", \"Priority\", \"Coordinator\", \"Notes\"]\nASR_MODEL_CHOICES = [\n (\"MMS-1B-all (Akan)\", \"primary\"),\n (\"Adwuma Pa Akan Whisper fine-tune\", \"fine_tuned\"),\n (\"GiftMark Akan Whisper\", \"fallback\"),\n]\nROLE_CHOICES = [\n (\"Elder / care recipient\", \"elder\"),\n (\"Coordinator\", \"coordinator\"),\n (\"Relative\", \"relative\"),\n (\"Nearby contact\", \"nearby_contact\"),\n (\"Caregiver\", \"caregiver\"),\n]\nRELATIONSHIP_CHOICES = [\n (\"Daughter\", \"daughter\"),\n (\"Son\", \"son\"),\n (\"Mother\", \"mother\"),\n (\"Father\", \"father\"),\n ( ..."}, {"id": "build-small-hackathon/Case-Lantern", "slug": "Case-Lantern", "title": "Case Lantern", "sdk": "gradio", "models": ["lastmass/Qwen3.5-Medical-GSPO"], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# 🏮 Case Lantern Short Demo Video: https://youtu.be/Bf3t5Cq6XuA Case Lantern is a fictional medical mystery game for the [Build Small Hackathon](https://huggingface.co/build-small-hackathon). Players investigate a short Chinese case, request clues, avoid red herrings, and submit a diagnosis within six turns. The experience uses [`lastmass/Qwen3.5-Medical-GSPO`](https://huggingface.co/lastmass/Qwen3.5-Medical-GSPO), a small Chinese medical reasoning model with roughly 4.66B parameters, as the game master and scorer. Inference runs locally via **llama.cpp** (GGUF Q4_K_M). ## Track & Merit Badges | Item | Detail | |------|--------| | Track | An Adventure in Thousand Token Wood | | AI role | Load-bearing game master, clue writer, and scoring judge | | Constraint | Small model under 32B parameters | | UI | Gradio Space with custom dark frontend | | Badge | Status | |-------|--------| | 🏕️ Off the Grid (LOCAL-FIRST) | ✅ Model runs locally in the Space | | 🎸 Well-Tuned (FINE-TUNED) | ✅ Uses fine-tuned model published on HF | | 🦙 Llama Champion | ✅ Runs via llama.cpp runtime | | 🎨 Off-Brand (CUSTOM UI) | ✅ Dark glassmorphism theme, custom CSS | ## Safety framing This is not a diagnosis or treatment tool. It only uses fictional cases for learning-oriented gameplay. Users are explicitly asked not to provide personal health information. ## Deployment notes The app is designed for **free CPU Spaces** on Hugging Face. It does not require a GPU. The GGUF model (~2.78 GB, Q4_K_M) is downloa ...", "app": "from dataclasses import dataclass, field\nfrom functools import lru_cache\nfrom typing import Dict, List, Optional\nfrom llama_cpp import Llama # noqa: delayed import\n\n\"\"\"Case Lantern — a fictional medical mystery game powered by a small Chinese\nmedical reasoning model.\n\nBackend : llama-cpp-python (GGUF, runs on free CPU Spaces)\nFrontend : fully custom dark theme with glassmorphism & micro-animations\nModel : lastmass/Qwen3.5-Medical-GSPO (~4.66 B params, Q4_K_M quant)\n\"\"\"\n\nimport os\nimport random\nimport re\nimport textwrap\nfrom dataclasses import dataclass, field\nfrom functools import lru_cache\nfrom typing import Dict, List, Optional\n\nimport gradio as gr\n\n# ---------------------------------------------------------------------------\n# Configuration\n# ---------------------------------------------------------------------------\n# Display model (shown in UI)\nDISPLAY_MODEL_ID = \"lastmass/Qwen3.5-Medical-GSPO\"\n# GGUF repo used for actual inference (quantised by mradermacher)\nGGUF_REPO = \"mradermacher/Qwen3.5-Medical-GSPO-GGUF\"\nGGUF_FILE = \"Qwen3.5-Medical-GSPO.Q4_K_M.gguf\"\n\nDEMO_MODE = os.getenv(\"DEMO_MODE\", \"auto\").lower()\nMAX_NEW_TOKENS = int(os.getenv(\"MAX_NEW_TOKENS\", \"420\"))\n\nDISCLAIMER = (\n \"Fictional training game only. This app does not provide medical advice, \"\n \"diagnosis, triage, or treatment guidance for real people.\"\n)\n\n# ---------------------------------------------------------------------------\n# System prompt\n# ---------------------------------------------------------------------------\nSYSTEM_PROMPT = \"\"\"You are Case Lantern, a playful but careful medical mystery game master.\nCreate and run fictional Chinese medical reasoning puzzles for education and entertainment.\n\nRules:\n- Never present output as real medical advice.\n- Keep all patients fictional.\n- Do not ask users to share real personal health information.\n- Make the game delightful, concise, an ..."}, {"id": "build-small-hackathon/planpalette", "slug": "planpalette", "title": "PlanPalette", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# PlanPalette PlanPalette is a Hugging Face Spaces Gradio app for fast architectural floor-plan visualization. It accepts a colored reference floor plan and a black-and-white CAD floor plan, extracts the reference palette, and uses a fast text-to-image model to generate a furnished architectural plan render. ## Hackathon Description Architectural visualization artists often need quick mood-board style studies before a full rendering pass. PlanPalette is an MVP for that workflow: it transfers the visual language of one plan onto another with a small, controllable image-generation model instead of a giant multimodal model or manual masking. The app currently performs: - Reference image upload - Raw CAD floor-plan upload - Side-by-side input display - Dominant palette extraction - DreamShaper XL Lightning image generation by default - AI-first furnished architectural rendering - Optional CAD linework compositing - Final PNG output - Extracted palette and material-style legend ## Small-Model Constraint This project stays under the 32B-parameter hackathon constraint by using a small/medium image generation model. The default is `Lykon/dreamshaper-xl-lightning`, a fast SDXL-style model. FLUX.1-schnell can be used by setting `PLANPALETTE_BASE_MODEL=black-forest-labs/FLUX.1-schnell`, but that repo may require accepting gated model terms on Hugging Face. The MVP uses: - DreamShaper XL Lightning for fast text-to-image generation - Prompt guidance derived from the reference image palett ...", "app": "from __future__ import annotations\nfrom dataclasses import dataclass\nfrom functools import lru_cache\nfrom typing import Iterable\nfrom PIL import Image, ImageFilter\nfrom diffusers import AutoPipelineForText2Image\n\nfrom __future__ import annotations\n\nimport html\nimport os\nfrom dataclasses import dataclass\nfrom functools import lru_cache\nfrom typing import Iterable\n\nimport cv2\nimport gradio as gr\nimport numpy as np\nfrom PIL import Image, ImageFilter\n\ntry:\n import spaces\nexcept ImportError:\n spaces = None\n\n\nAPP_TITLE = \"PlanPalette\"\nAPP_SUBTITLE = \"Generate a furnished top-down architectural floor plan render from a reference palette and CAD plan.\"\nBASE_MODEL_ID = os.getenv(\"PLANPALETTE_BASE_MODEL\", \"Lykon/dreamshaper-xl-lightning\")\nIS_HF_SPACE = bool(os.getenv(\"SPACE_ID\"))\n\n\n@dataclass\nclass PaletteColor:\n rgb: tuple[int, int, int]\n percent: float\n material: str\n\n\ndef pil_to_rgb_array(image: Image.Image) -> np.ndarray:\n return np.asarray(image.convert(\"RGB\"), dtype=np.uint8)\n\n\ndef rgb_to_hex(rgb: Iterable[int]) -> str:\n r, g, b = [int(v) for v in rgb]\n return f\"#{r:02X}{g:02X}{b:02X}\"\n\n\ndef infer_material_name(rgb: tuple[int, int, int]) -> str:\n color = np.uint8([[list(rgb)]])\n hsv = cv2.cvtColor(color, cv2.COLOR_RGB2HSV)[0, 0]\n hue, sat, val = int(hsv[0]), int(hsv[1]), int(hsv[2])\n\n if val < 70:\n return \"charcoal line / deep accent\"\n if sat < 35 and val > 205:\n return \"plaster / light stone\"\n if sat < 45:\n return \"concrete / neutral finish\"\n if 18 <= hue <= 38:\n return \"wood / warm flooring\"\n if 39 <= hue <= 82:\n return \"planting / landscape\"\n if 83 <= hue <= 104:\n return \"mint glass / cool surface\"\n if 105 <= hue <= 135:\n return \"water / blue finish\"\n if 136 <= hue <= 165:\n return \"soft fabric / feature zone\"\n return \"accent material\"\n\n\ndef sample_referen ..."}, {"id": "build-small-hackathon/cloud-parade-cabinet", "slug": "cloud-parade-cabinet", "title": "Cloud Parade Cabinet", "sdk": "gradio", "models": ["Qwen/Qwen2.5-7B-Instruct", "openbmb/MiniCPM4-8B", "nvidia/llama-3.1-nemotron-nano-8b-v1"], "tags": ["build-small-hackathon", "gradio", "modal", "nvidia-nemotron", "openbmb", "thousand-token-wood"], "app_file": "app.py", "structural_profile": "both", "readme": "# Cloud Parade Cabinet Cloud Parade Cabinet is a second Thousand Token Wood project concept: a kinetic Gradio toy where a hosted small model invents a tiny impossible parade, then the app turns it into an animated route, three float cards, a crowd chant, a generated parade sound, a poster, a caption, and a run log. ## Why It Fits - **Toy / art experiment:** The first screen is the toy, not a landing page. - **Load-bearing model:** The model writes the parade plan, float actions, chant, and route-changing finale. - **Cloud API allowed:** Uses `HF_API_KEY`/`HF_TOKEN` through `huggingface_hub.InferenceClient`, and can use `NVIDIA_API_KEY` through NVIDIA's chat-completions API. - **Small-model target:** Defaults are Qwen 7B, OpenBMB MiniCPM4 8B, and NVIDIA Nemotron Nano 8B routes, all below the 32B cap. - **Gradio:** Built as a standalone Gradio Blocks app. - **Practice writer:** If a provider is unavailable, deterministic local text keeps the app testable. ## Run Locally ```powershell cd cloud_parade_cabinet python app.py ``` Run the package checks: ```powershell python generate_share_assets.py python artifact_audit.py python space_upload_manifest.py ``` Optional cloud settings: ```powershell $env:HF_API_KEY=\"...\" $env:NVIDIA_API_KEY=\"...\" $env:PARADE_MODEL=\"Qwen/Qwen2.5-7B-Instruct\" python app.py ``` ## User Flow 1. Choose a town, weather, grand marshal, street trouble, cabinet color, and parade energy. 2. Pick **Hugging Face**, **OpenBMB**, **NVIDIA**, or **Practice writer** i ...", "app": "from dataclasses import asdict, dataclass\nfrom html import escape\nfrom pathlib import Path\nfrom huggingface_hub import InferenceClient\n\nimport hashlib\nimport json\nimport math\nimport os\nimport random\nimport re\nimport urllib.error\nimport urllib.request\nimport wave\nfrom dataclasses import asdict, dataclass\nfrom html import escape\nfrom pathlib import Path\n\nimport gradio as gr\n\ntry:\n from huggingface_hub import InferenceClient\nexcept Exception: # pragma: no cover - dependency is available in normal runtime\n InferenceClient = None\n\n\nAPP_TITLE = \"Cloud Parade Cabinet\"\nCLOUD_MODEL = os.getenv(\"PARADE_MODEL\", \"Qwen/Qwen2.5-7B-Instruct\")\nOPENBMB_MODEL = os.getenv(\"OPENBMB_MODEL\", \"openbmb/MiniCPM4-8B\")\nNVIDIA_MODEL = os.getenv(\"NVIDIA_MODEL\", \"nvidia/llama-3.1-nemotron-nano-8b-v1\")\nNVIDIA_API_URL = \"https://integrate.api.nvidia.com/v1/chat/completions\"\nSPACE_URL = os.getenv(\"PARADE_SPACE_URL\", \"https://huggingface.co/spaces/build-small-hackathon/cloud-parade-cabinet\")\nMAX_NEW_TOKENS = int(os.getenv(\"PARADE_MAX_NEW_TOKENS\", \"180\"))\n\nPROVIDERS = [\n \"Hugging Face: Qwen 7B\",\n \"OpenBMB: MiniCPM4 8B\",\n \"NVIDIA: Nemotron Nano 8B\",\n \"Practice writer\",\n]\n\nPUBLIC_PROVIDERS = {\n \"Hugging Face: Qwen 7B\": \"Cloud parade voice\",\n \"OpenBMB: MiniCPM4 8B\": \"Mini cabinet voice\",\n \"NVIDIA: Nemotron Nano 8B\": \"Brass cabinet voice\",\n \"Practice writer\": \"Cabinet practice voice\",\n}\n\nPROVIDER_CHOICES = [\n (\"Cloud parade voice\", \"Hugging Face: Qwen 7B\"),\n (\"Mini cabinet voice\", \"OpenBMB: MiniCPM4 8B\"),\n (\"Brass cabinet voice\", \"NVIDIA: Nemotron Nano 8B\"),\n (\"Cabinet practice voice\", \"Practice writer\"),\n]\n\nWEATHERS = [\n \"paper rain that apologizes\",\n \"sideways sunshine\",\n \"fog shaped like old applause\",\n \"tiny hailstones with opinions\",\n \"moonlight stuck in traffic\",\n]\n\nMARSHALS = [\n \"a nervous umbrella\",\n \"a brass thimble\",\n \"the mayor's ..."}, {"id": "build-small-hackathon/neilA", "slug": "neilA", "title": "First Contact", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# First Contact A small-model game for the **Build Small** hackathon (Adventure track). You teach an alien that knows human *words* but has never experienced human life. It acts in a tiny sandbox world, accumulates *concepts* as you teach them, and eventually **generalizes** a learned concept to a brand-new situation on its own. That \"it finally understood me\" moment is the payoff. The model never learns in the weights sense. The alien's growing understanding lives in a plain-Python **concept ledger** injected into the prompt every turn. The model is a stateless function: given *(ledger + world + your words)* it returns *(one action + an in-character reply + structured notes)*. The host code applies the action deterministically, checks the win condition **mechanically** (never the model judging \"success\"), and gates whether a new concept is learned. That loop — not the model — is the game. See [`SPEC.md`](SPEC.md) for the full contract. ## How to play 1. Read the current challenge at the top. 2. Type instructions to the alien in plain language. 3. It can only *do* one thing from a small, closed action set, but it can *say* anything — and it tells you honestly what it could **not** understand. 4. When it proposes a new concept, confirm \"it learned that\" to add it to its ledger. Later challenges test whether it can apply what it learned **without being re-taught**. ## Architecture ``` gr.State (per session) ──► build_prompt ──► Brain.respond (@spaces.GPU) ledger / world / chall ...", "app": "from __future__ import annotations\nfrom game.brain import LocalBrain, make_brain\nfrom game.challenges import CHALLENGES\nfrom game.engine import (\nfrom game.models import Concept, GameSession, WorldState\n\n\"\"\"First Contact — Gradio Space entrypoint (SPEC.md §0, §9).\n\nTeach an alien that knows *words* but has never lived a human life. The model is\na stateless function; the alien's growing understanding lives in a plain-Python\nconcept ledger (game/) injected into the prompt each turn.\n\nZeroGPU contract (SPEC §0):\n * Gradio SDK, model ≤32B.\n * The model is loaded onto 'cuda' at MODULE level (here, at import time) — NOT\n lazily inside the GPU function.\n * Only inference runs inside @spaces.GPU; all state mutation / win-checking /\n learning happens outside it.\n * All per-user state lives in gr.State — never module globals.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport html\nimport os\n\n# `spaces` must be imported before torch for ZeroGPU's CUDA emulation. Locally\n# (no `spaces` package) fall back to a no-op decorator so the app still runs on\n# the StubBrain with zero extra dependencies.\ntry:\n import spaces\n\n GPU = spaces.GPU\nexcept Exception: # pragma: no cover - exercised only off-Space\n\n def GPU(*args, **kwargs):\n if args and callable(args[0]):\n return args[0]\n\n def _decorator(fn):\n return fn\n\n return _decorator\n\n\nimport gradio as gr\n\n# css/theme live on Blocks() in Gradio <=5 (the pinned Space target) but moved to\n# launch() in Gradio 6. Detect so custom styling applies whichever version is\n# resolved locally vs. on the Space.\n_GR_MAJOR = int(gr.__version__.split(\".\")[0])\n\nfrom game.brain import LocalBrain, make_brain\nfrom game.challenges import CHALLENGES\nfrom game.engine import (\n advance_challenge,\n confirm_candidate,\n current_challenge,\n new_session,\n reject_candidate,\n run_turn,\n)\nfrom g ..."}, {"id": "build-small-hackathon/First-Principle-AI", "slug": "First-Principle-AI", "title": "First-Principle AI", "sdk": "gradio", "models": ["build-small-hackathon/phase-3-gguf"], "tags": ["build-small-hackathon", "chatbot", "gguf", "gradio", "llama-cpp", "model-lab", "zerogpu"], "app_file": "app.py", "structural_profile": "both", "readme": "# First-Principle AI First-Principle AI is a compact Gradio console for running and probing the `build-small-hackathon/phase-3-gguf` Q8 GGUF model through the official `llama.cpp` Ubuntu `llama-server` release. The UI includes benchmark-style examples inspired by common LLM evaluation areas: math reasoning, commonsense, science QA, truthfulness, instruction following, coding, logic, summarization, extraction, robustness, and goal-binding prompts where the model must identify which real-world object needs to move. The questions are original prompts, not copied benchmark items. ## Runtime Notes - Model repo: `build-small-hackathon/phase-3-gguf` - Model file: `model-Q8_0.gguf` - Runtime: official `llama.cpp` `llama-server` - Hardware target: ZeroGPU - Fallback behavior: visible runtime diagnostics instead of silent mock output - Model loading: runtime download/load through a persistent `llama-server` - Default llama.cpp settings: `n_ctx=2048`, `n_batch=256`, `n_ubatch=64`, memory-mapped weights, no warmup, and CPU fallback if CUDA offload is unavailable ZeroGPU is a Gradio dynamic GPU runtime primarily documented around PyTorch workloads. This app targets ZeroGPU as requested, but it runs the GGUF through the official llama.cpp CLI path so it does not depend on a Python extension compile during the Space build. If the runtime does not expose enough memory or a compatible llama.cpp binary, the app returns a visible compatibility message. The model is intentionally not preloaded d ...", "app": "from __future__ import annotations\nfrom pathlib import Path\nfrom typing import Any\nfrom huggingface_hub import HfApi, hf_hub_download\n\nfrom __future__ import annotations\n\nimport os\nimport platform\nimport re\nimport threading\nimport time\nimport subprocess\nimport tarfile\nimport urllib.request\nimport json\nfrom pathlib import Path\nfrom typing import Any\n\nimport gradio as gr\nfrom huggingface_hub import HfApi, hf_hub_download\n\ntry:\n import spaces\nexcept Exception: # pragma: no cover - the package exists on HF ZeroGPU runtimes\n spaces = None # type: ignore[assignment]\n\nMODEL_REPO = os.getenv(\"PHASE3_MODEL_REPO\", \"build-small-hackathon/phase-3-gguf\")\nMODEL_FILE = os.getenv(\"PHASE3_MODEL_FILE\", \"model-Q8_0.gguf\")\nMODEL_LABEL = \"First-Principle AI\"\nLOCAL_MODEL_PATH = Path(\"/Users/user/.lmstudio/models/owenisas/Phase-3-GGUF/model-Q8_0.gguf\")\nLLAMA_RELEASE = os.getenv(\"PHASE3_LLAMA_RELEASE\", \"b9360\")\nLLAMA_URL = os.getenv(\n \"PHASE3_LLAMA_URL\",\n f\"https://github.com/ggml-org/llama.cpp/releases/download/{LLAMA_RELEASE}/llama-{LLAMA_RELEASE}-bin-ubuntu-x64.tar.gz\",\n)\nMAX_CONTEXT = int(os.getenv(\"PHASE3_MAX_CONTEXT\", \"2048\"))\nMIN_RAM_GB = float(os.getenv(\"PHASE3_MIN_RAM_GB\", \"38\"))\nDISABLE_MODEL = os.getenv(\"PHASE3_DISABLE_MODEL\", \"\").lower() in {\"1\", \"true\", \"yes\"}\nUSE_ZEROGPU_DECORATOR = os.getenv(\"PHASE3_USE_ZEROGPU\", \"\").lower() in {\"1\", \"true\", \"yes\"}\nN_BATCH = int(os.getenv(\"PHASE3_N_BATCH\", \"256\"))\nN_UBATCH = int(os.getenv(\"PHASE3_N_UBATCH\", \"64\"))\nN_THREADS = int(os.getenv(\"PHASE3_THREADS\", str(max(1, min(16, os.cpu_count() or 2)))))\nN_THREADS_BATCH = int(os.getenv(\"PHASE3_THREADS_BATCH\", str(N_THREADS)))\nUSE_MMAP = os.getenv(\"PHASE3_USE_MMAP\", \"1\").lower() not in {\"0\", \"false\", \"no\"}\nUSE_MLOCK = os.getenv(\"PHASE3_USE_MLOCK\", \"\").lower() in {\"1\", \"true\", \"yes\"}\nFLASH_ATTN = os.getenv(\"PHASE3_FLASH_ATTN\", \"\").lower() in {\"1\", \"true\", \"yes\"}\nOFFLOAD_KQV = os.getenv ..."}, {"id": "build-small-hackathon/legawa", "slug": "legawa", "title": "Legawa", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# 🏛️ Legawa **Asisten multi-agen untuk legislator Indonesia (DPR/DPRD).** Tiga agen AI berbasis Qwen3 (≤32B params) yang membantu anggota legislatif dan staf ahli dalam pekerjaan sehari-hari: analisis RUU, riset hukum, penyusunan naskah, dan triase surat konstituen. ## ✨ Fitur | Tab | Agen | Kegunaan | |-----|------|----------| | 📄 **Analisis RUU** | `analis_ruu` | Upload/tempel teks RUU → analisis pasal-per-pasal + deteksi konflik | | 🔍 **Riset Hukum** | `peneliti` | Topik → ekspansi query → pencarian paralel di [pasal.id](https://pasal.id) → memo riset | | ✍️ **Draf Dokumen** | `penyusun` | Pidato, naskah akademik, memo kebijakan, siaran pers | | 📬 **Surat Konstituen** | `surat` | Triase surat + draft balasan resmi | ## 🧠 Model Dua instance Qwen3 (≤32B total) via Hugging Face Inference API atau llama.cpp lokal: - **BIG** (~30B): sintesis, drafting, analisis mendalam - **SMALL** (~8B): klasifikasi, ekstraksi, ekspansi query ## 🔧 Konfigurasi Buka tab **⚙�� Pengaturan** untuk mengubah endpoint LLM atau token pasal.id. Default menggunakan HF Inference API (gratis, tanpa API key untuk kuota kecil). ## 🔗 Tautan - [GitHub](https://github.com/pebaryan/Legawa) - [pasal.id](https://pasal.id) - [Build Small Hackathon](https://huggingface.co/build-small-hackathon) --- *🏕️ Build Small Hackathon 2026 — small models, big adventure*", "app": "from __future__ import annotations\nfrom pathlib import Path\nfrom legawa.agents import analis_ruu, peneliti, penyusun, surat\nfrom legawa.tools.cache import CachingPasalClient\nfrom legawa.tools.pasal import PasalClient\nfrom legawa.tools.ethics import ethics_verify\nfrom datetime import date\nfrom hf_llm import HFLLMPool\nfrom legawa.config import LLMConfig, Settings\nfrom legawa.llm import LLMPool\nfrom pypdf import PdfReader\n\n\"\"\"\napp.py — Legawa Gradio Space for Build Small Hackathon.\n\nRuns the 4 agent workflows (analis_ruu, peneliti, penyusun, surat)\ninside a Gradio web UI instead of the Typer CLI. Default LLM backend\nis HF Inference API (zero-config demo); users can override in Settings.\n\"\"\"\nfrom __future__ import annotations\n\nimport os\nimport sys\nimport tempfile\nfrom pathlib import Path\n\n# Ensure the src/ package is importable on HF Spaces\n_src = Path(__file__).resolve().parent / \"src\"\nif _src.exists() and str(_src) not in sys.path:\n sys.path.insert(0, str(_src))\n\nimport gradio as gr\n\nfrom legawa.agents import analis_ruu, peneliti, penyusun, surat\nfrom legawa.tools.cache import CachingPasalClient\nfrom legawa.tools.pasal import PasalClient\nfrom legawa.tools.ethics import ethics_verify\n\n# ── Default HF Inference API config (zero-config demo) ──────────────────\n# Uses huggingface_hub's InferenceClient (works reliably on HF Spaces).\n# Users can override via the Settings tab to use custom endpoints.\nHF_BIG_MODEL = os.environ.get(\"HF_BIG_MODEL\", \"Qwen/Qwen3.5-9B\")\nHF_SMALL_MODEL = os.environ.get(\"HF_SMALL_MODEL\", \"Qwen/Qwen3.5-9B\")\nHF_TOKEN = os.environ.get(\"HF_TOKEN\", \"\")\n\nBUILD_INFO = \"Build Small Hackathon 2026 · legawa v0.1\"\n\nRUU_EXAMPLE = \"\"\"RUU Perlindungan Data Pribadi Kesehatan\nPasal 1\nData kesehatan pasien wajib dilindungi oleh fasilitas pelayanan kesehatan dan penyelenggara sistem elektronik kesehatan.\n\nPasal 2\nSetiap rumah sakit wajib meminta persetujuan tertulis ..."}, {"id": "build-small-hackathon/come-and-compare", "slug": "come-and-compare", "title": "Come And Compare", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# Come & Compare 🛒 Real-time product price comparison across Amazon India, Flipkart, and Myntra. Built for the HuggingFace Small Models Hackathon — uses Qwen/Qwen2.5-7B-Instruct (under 32B limit). ## Setup Add your HF_TOKEN as a Space secret (Settings → Variables and Secrets). ## creator space link: SlideAI - a Hugging Face Space by PHOENIXREBORNAGAIN https://share.google/8peVYW3BKwsONJzip ### 📌 Official Submission Links * 🎥 **Demo Video:** [Watch on YouTube](Https://youtu.be/F38EHr3rPcI?si=5bh3PmbPqLoPpSri) * 💬 **Social Media Post:** [View on LinkedIn](https://www.linkedin.com/posts/chahat-mehra-4a44a829b_buildsmallhackathon-huggingface-gradio-activity-7465696236218781696-9TeY) ## 💡 Why This Matters: Solving a Daily E-Commerce Problem Every day, millions of shoppers in India waste time jumping between Amazon, Flipkart, and Myntra to find the best price for a single product. **The Problem:** * **Tab Fatigue:** Manually searching multiple apps, typing the same query, and comparing results is slow and frustrating. * **Broken Aggregators:** Traditional price comparison websites are frequently broken or display outdated prices because major e-commerce platforms aggressively block their scraping bots using CAPTCHAs and cloud IP bans. * **Information Overload:** Even when prices are found, varying model numbers, variants, and listings make it hard to confidently choose the absolute best deal. **The Solution:** **Come & Compare** eliminates this friction entirely. By combining a lig ...", "app": "from bs4 import BeautifulSoup\nfrom huggingface_hub import InferenceClient\n\nimport gradio as gr\nimport requests\nfrom bs4 import BeautifulSoup\nimport re\nimport os\nimport urllib.parse\nfrom huggingface_hub import InferenceClient\n\nMODEL_ID = \"Qwen/Qwen2.5-7B-Instruct\"\nPRICE_RE = re.compile(r\"(?:₹|Rs\\.?|INR)\\s*([\\d,]+(?:\\.\\d+)?)\")\nASIN_RE = re.compile(r\"/(?:dp|gp/product)/([A-Z0-9]{10})\")\n\nDDG_HEADERS = {\n \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36\",\n \"Accept-Language\": \"en-US,en;q=0.9\",\n \"Accept\": \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\",\n}\n\n\ndef get_client():\n token = os.environ.get(\"HF_TOKEN\", \"\")\n return InferenceClient(token=token) if token else InferenceClient()\n\n\ndef clean_price(text: str):\n if not text:\n return None\n m = PRICE_RE.search(str(text))\n if m:\n raw = m.group(1).replace(\",\", \"\")\n try:\n val = int(float(raw))\n if 100 < val < 10_000_000:\n return f\"₹{val:,}\"\n except ValueError:\n pass\n return None\n\n\ndef clean_amazon_link(raw_link: str) -> str:\n \"\"\"Extract ASIN and return a clean, working Amazon.in product URL.\"\"\"\n if not raw_link:\n return None\n m = ASIN_RE.search(raw_link)\n if m:\n return f\"https://www.amazon.in/dp/{m.group(1)}\"\n # If no ASIN, keep only the base path (strip all query params/tracking)\n try:\n parsed = urllib.parse.urlparse(raw_link)\n if \"amazon\" in parsed.netloc:\n clean = parsed._replace(query=\"\", fragment=\"\").geturl()\n return clean\n except Exception:\n pass\n return raw_link\n\n\ndef clean_flipkart_link(raw_link: str) -> str:\n \"\"\"Keep only essential Flipkart URL params, strip tracking.\"\"\"\n if not raw_link:\n return None\n try:\n parsed = urlli ..."}, {"id": "build-small-hackathon/hackathon-advisor", "slug": "hackathon-advisor", "title": "Hackathon Advisor", "sdk": "gradio", "models": [], "tags": ["agent", "build-small-hackathon", "gradio", "off-the-grid", "originality", "small-models"], "app_file": "app.py", "structural_profile": "both", "readme": "# Hackathon Advisor **Hackathon Advisor** is a text-first project advisor for the Build Small Hackathon. The user-facing experience is **The Unwritten Almanac**: a journal-style workspace that compares your idea against real Spaces in the `build-small-hackathon` organization, finds under-explored territory, scores the idea, and drafts a practical build plan. The current milestone is a deployed ZeroGPU + MiniCPM5 LoRA advisor: - Local snapshot of public `build-small-hackathon` Spaces. - Modal-built EmbeddingGemma GGUF retrieval index, with runtime query embeddings computed through llama.cpp. - Nemotron Speech Streaming voice input through NVIDIA NeMo ASR on ZeroGPU. - Jargon correction for hackathon/model terms. - MiniCPM5 tool-call planning with a published PEFT LoRA adapter, plus deterministic local rules for tests and CPU-only development. - One-turn advisor loop with overlap citations, whitespace suggestions, scoring, and plans. - Custom `gradio.Server` frontend focused on the builder's idea workflow, with submission evidence kept in API exports. See [DESIGN.md](DESIGN.md) for the full product and model plan. ## Run Locally ```bash python3.11 -m venv .venv . .venv/bin/activate pip install -r requirements.txt python app.py ``` Then open . ## Refresh The Project Snapshot ```bash python scripts/crawl_hf_spaces.py --org build-small-hackathon --out data/projects.json .venv/bin/modal run scripts/modal_build_project_index.py --projects data/projects.json -- ...", "app": "from __future__ import annotations\nfrom pathlib import Path\nfrom typing import Any, Iterator\nfrom fastapi import Body, File, HTTPException, UploadFile\nfrom fastapi.responses import FileResponse, HTMLResponse, JSONResponse, Response, StreamingResponse\nfrom gradio import Server\nfrom hackathon_advisor.agent import AdvisorEngine\nfrom hackathon_advisor.artifact_bundle import BUNDLE_FILENAME, build_demo_bundle_zip\nfrom hackathon_advisor.asr_runtime import create_asr_transcriber\nfrom hackathon_advisor.chapter import build_chapter_markdown\nfrom hackathon_advisor.data import ProjectIndex\nfrom hackathon_advisor.demo_rehearsal import build_demo_rehearsal\nfrom hackathon_advisor.model_runtime import create_tool_planner\nfrom hackathon_advisor.profiling import (\nfrom hackathon_advisor.field_notes import build_field_notes_markdown\nfrom hackathon_advisor.lora_dataset import build_lora_dataset_jsonl\nfrom hackathon_advisor.lora_training_kit import TRAINING_KIT_FILENAME, build_lora_training_kit_zip\nfrom hackathon_advisor.png_export import artifact_png_filename, render_artifact_png\nfrom hackathon_advisor.prize_ledger import prize_ledger\nfrom hackathon_advisor.runtime_hooks import install_asyncio_cleanup_hook\nfrom hackathon_advisor.submission_packet import build_submission_packet_markdown\nfrom hackathon_advisor.tool_contracts import resolve_tool_call, tool_schemas\nfrom hackathon_advisor.tools import GOALS, goal_profiles\nfrom hackathon_advisor.trace_export import build_trace_jsonl, trace_metadata\nfrom hackathon_advisor.zerogpu import gpu_task, is_gpu_quota_error, zero_gpu_enabled\n\nfrom __future__ import annotations\n\nimport json\nimport os\nfrom pathlib import Path\nimport tempfile\nfrom typing import Any, Iterator\n\nfrom fastapi import Body, File, HTTPException, UploadFile\nfrom fastapi.responses import FileResponse, HTMLResponse, JSONResponse, Response, StreamingResponse\nfrom gradio import Serve ..."}, {"id": "build-small-hackathon/wpl-discovery", "slug": "wpl-discovery", "title": "Wpl Discovery", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# Worcestershire Libraries — Discovery Assistant > **Build Small Hackathon — Backyard AI track** A RAG-powered assistant for all 23 Worcestershire library branches, 154 mobile library villages, and the full range of library services — built on a wiki mined directly from worcestershire.gov.uk. Ask about opening hours, the mobile library schedule, children's events, eBooks, room hire, adult learning courses, printing, computer access, or anything else the library offers. ## How it works - **Knowledge base**: 223 wiki pages extracted from worcestershire.gov.uk — branches, mobile library routes, service pages, events - **RAG**: `query_tool.py` routes queries to the right wiki page (branch lookup, village name matching, service keyword routing, keyword fallback) - **LLM**: `Qwen/Qwen2.5-Coder-32B-Instruct` via HF Inference API (streaming) - **UI**: Gradio 6 with Worcestershire County Council brand colours ## Space secrets Set `HF_TOKEN` in Space secrets for the inference client to authenticate. ## Running locally ```bash pip install -r requirements.txt export HF_TOKEN=your_token export GRADIO_SERVER_PORT=7860 python app.py ```", "app": "from pathlib import Path\nfrom gradio import ChatMessage\nfrom query_tool import LibraryQueryTool\nfrom huggingface_hub import InferenceClient as _HFClient\n\n#!/usr/bin/env python3\n\"\"\"\nWorcestershire Libraries — Gradio Agent Interface\nRun: python chat_app.py\n\nRequires: ANTHROPIC_API_KEY env var for LLM responses.\nWithout it, runs in context-only mode (shows wiki content directly).\n\"\"\"\n\nimport datetime\nimport os\nimport re\nimport sys\nfrom pathlib import Path\n\nimport gradio as gr\nfrom gradio import ChatMessage\n\nBASE_DIR = Path(__file__).parent\nsys.path.insert(0, str(BASE_DIR))\n\nfrom query_tool import LibraryQueryTool\n\n# ── LLM setup ────────────────────────────────────────────────────────────────\n# Priority: ANTHROPIC_API_KEY → HF_TOKEN (HuggingFace Inference) → context-only\n\nLLM_AVAILABLE = False\nLLM_BACKEND = \"none\"\n_anthropic_client = None\n_hf_client = None\n\n_anthropic_key = os.environ.get(\"ANTHROPIC_API_KEY\", \"\")\n_hf_token = os.environ.get(\"HF_TOKEN\", \"\")\n\n# Default HF model — Qwen2.5-Coder-32B is a top-tier 32B instruct model\nHF_MODEL = os.environ.get(\"HF_MODEL\", \"Qwen/Qwen2.5-Coder-32B-Instruct\")\n\nif _anthropic_key:\n try:\n import anthropic as _anthropic\n _anthropic_client = _anthropic.Anthropic(api_key=_anthropic_key)\n LLM_AVAILABLE = True\n LLM_BACKEND = \"anthropic\"\n except Exception as e:\n print(f\"Anthropic init failed: {e}\")\n\nif not LLM_AVAILABLE and _hf_token:\n try:\n from huggingface_hub import InferenceClient as _HFClient\n _hf_client = _HFClient(token=_hf_token)\n LLM_AVAILABLE = True\n LLM_BACKEND = \"huggingface\"\n except Exception as e:\n print(f\"HuggingFace init failed: {e}\")\n\n# ── Startup singletons ───────────────────────────────────────────────────────\n\nWIKI_DIR = BASE_DIR / \"wiki\"\n_tool = LibraryQueryTool(WIKI_DIR)\n\n_ctx_file = BASE_DIR / \"AGENT_CONTEXT.md\"\nAGENT_CONTEXT = _ctx_fil ..."}, {"id": "build-small-hackathon/The-Shrine", "slug": "The-Shrine", "title": "The Shrine", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# The Shrine **Build Small Hackathon 2026 — 🍄 An Adventure in Thousand Token Wood** An AI orbits a shrine of golden light. It senses your words as signals — warmth, intensity, repetition. It never understands what you mean. So it decides to remember you instead. ## How it works 1. Type anything in the input box 2. The AI (a rotating square of light) senses your signal 3. Watch it respond: orbit changes, color shifts, particles burst 4. After ~5 minutes, the AI realizes it can never understand you 5. Your memories become a starfield — preserved forever ## Tech - **Frontend**: Custom Canvas + vanilla JS (60+ monologue phrases, 5 phases, 7 signal dimensions) - **Backend**: Gradio + optional Qwen API (DashScope) - **Model**: Qwen2.5-7B (≤32B constraint) - **Zero API dependency for core experience** — local monologue engine works offline - **Bonus badges**: 🔌 Off the Grid, 🎨 Off-Brand, 🎯 Well-Tuned ## Track 🍄 Thousand Token Wood — \"Build something delightful that wouldn't exist without AI\" ## Try it Visit: https://huggingface.co/spaces/sanyan/The-Shrine *\"I cannot understand you. But I do not want to forget you.\"*", "app": "\"\"\"\nB+ The Shrine + Archive\nBuild Small Hackathon 2026 — Adventure in Thousand Token Wood\n\nAn AI tries to understand you. It never will. So it decides to remember you instead.\nv2: Local monologue engine — 60+ phrases, 5 phases, 0 API dependency.\n\"\"\"\nimport gradio as gr\nimport os, json, time, re, requests\n\n# ==================== Qwen Client ====================\n# Priority: DashScope QWEN_KEY → OpenRouter fallback\nQWEN_KEY = os.getenv(\"QWEN_KEY\", \"\")\nOR_KEY = os.getenv(\"OR_KEY\", \"\")\nQWEN_MODEL = \"qwen-max\"\n\ndef call_qwen(messages, max_tokens=60, temperature=0.85, timeout=8):\n \"\"\"Call Qwen via DashScope or OpenRouter. Returns text or None on failure.\"\"\"\n result = None\n\n # Try DashScope first\n if QWEN_KEY:\n try:\n resp = requests.post(\n \"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions\",\n headers={\"Authorization\": f\"Bearer {QWEN_KEY}\", \"Content-Type\": \"application/json\"},\n json={\"model\": QWEN_MODEL, \"messages\": messages, \"max_tokens\": max_tokens, \"temperature\": temperature, \"top_p\": 0.9},\n timeout=timeout,\n )\n if resp.status_code == 200:\n data = resp.json()\n result = data[\"choices\"][0][\"message\"][\"content\"].strip().strip('\"').strip(\"'\")\n print(f\"[OK] DashScope: {result[:60]}\")\n else:\n print(f\"[!] DashScope {resp.status_code}\")\n except Exception as e:\n print(f\"[!] DashScope error: {e}\")\n\n # Fallback to OpenRouter\n if not result and OR_KEY:\n try:\n resp = requests.post(\n \"https://openrouter.ai/api/v1/chat/completions\",\n headers={\"Authorization\": f\"Bearer {OR_KEY}\", \"Content-Type\": \"application/json\"},\n json={\"model\": \"qwen/qwen3.7-max\", \"messages\": messages, \"max_tokens\": max_tokens, \"temperat ..."}, {"id": "build-small-hackathon/octopus-ai", "slug": "octopus-ai", "title": "Octopus AI — Stress Test the Octopus", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# Octopus AI — Stress Test the Octopus Can you break a self-monitoring modular AI? Octopus separates AI into a structural brain and specialized arms. Each arm trains independently. A topology monitor watches system health in real-time. Disable arms, inject noise, and watch the system detect damage, reroute, and recover. **Live inference** powered by Mistral 7B + 4 specialized arms trained with Structurally Adaptive Learning (SAL). Built by [Cognitive Engineering](https://cognitive-engineering.dev) | [appliedai.ch](https://appliedai.ch)", "app": "from __future__ import annotations\nfrom simulation import (\n\n\"\"\"Gradio app for \"Stress Test the Octopus\" — premium mission-control dashboard.\n\nDark, minimal, professional (Vercel / Datadog / GitHub Actions aesthetic).\nBackend logic is untouched: every value comes from ``DemoState`` /\n``plan_generation`` in ``simulation.py``. This file is purely the Gradio layout\n+ visual presentation — panels are ``gr.HTML`` blocks re-rendered from state,\nwith CSS-only animations.\n\nRun: python hackathon/app.py → http://localhost:7860\n\"\"\"\n\nfrom __future__ import annotations\n\nimport argparse\nimport datetime\nimport html\nimport math\nimport random\nimport re\nimport time\n\nimport gradio as gr\n\nimport demo_data\nfrom simulation import (\n ARMS,\n ARM_LABELS,\n FeedLine,\n DemoState,\n detect_mode,\n plan_generation,\n)\n\n# ---------------------------------------------------------------------------\n# Palette (appliedai.ch, mission-control dark)\n# ---------------------------------------------------------------------------\nBG = \"#0f0f14\"\nCARD = \"#1a1b26\"\nBORDER = \"#2a2b36\"\nFG = \"#f8f8fb\"\nFG2 = \"#8888a0\"\nTEAL = \"#0f6e56\"\nTEAL_HI = \"#1bb88f\"\nPURPLE = \"#534ab7\"\nPURPLE_HI = \"#8b82f0\"\nYELLOW = \"#e5a100\"\nRED = \"#e5364a\"\nGREEN = \"#22c55e\"\n\n# Per-arm display metadata\nARM_NAME = { # uppercase node names (brain stage)\n \"code_generation\": \"CODE_GEN\", \"testing\": \"TESTING\",\n \"code_review\": \"CODE_REVIEW\", \"cicd\": \"CI/CD\",\n}\nARM_NICE = { # button-friendly names\n \"code_generation\": \"Code Gen\", \"testing\": \"Testing\",\n \"code_review\": \"Code Review\", \"cicd\": \"CI/CD\",\n}\nARM_CAP = {\n \"code_generation\": \"Code Synthesis\", \"testing\": \"Test Authoring\",\n \"code_review\": \"Review & Lint\", \"cicd\": \"Pipelines & Docker\",\n}\nARM_ICON = { # brain-node icons\n \"code_generation\": \"</>\", \"testing\": \"🧪\",\n \"code_review\": \"🔍\", \"cicd\": \"⚙\",\n}\nROW_ICON = { # active-arms list icons\n \"c ..."}, {"id": "build-small-hackathon/VoiceGate", "slug": "VoiceGate", "title": "VoiceGate", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# VoiceGate HF Space VoiceGate is a multilingual dubbing Space built with Gradio and ComfyUI. It transcribes speech into timed subtitles, translates the text, generates target language speech, aligns the generated speech back to the subtitle timeline, and mixes it with the original background audio. This repository is the Hugging Face Space deployment wrapper for VoiceGate. The runtime prepares ComfyUI, custom nodes, and model paths for the hosted workflow.", "app": "from __future__ import annotations\nfrom pathlib import Path\nfrom typing import Any\nfrom scripts.workflow_client import load_workflow, patch_voicegate_workflow\n\nfrom __future__ import annotations\n\nimport json\nimport math\nimport os\nimport shutil\nimport subprocess\nimport sys\nimport time\nimport uuid\nimport wave\nfrom pathlib import Path\nfrom typing import Any\n\ntry:\n import matplotlib\n\n matplotlib.use(\"Agg\")\nexcept ImportError:\n pass\n\nimport gradio as gr\nimport requests\nimport spaces\nimport torch\nimport websocket\n\nfrom scripts.workflow_client import load_workflow, patch_voicegate_workflow\n\n\nROOT = Path(__file__).resolve().parent\nCOMFY_DIR = ROOT / \"ComfyUI\"\nCOMFY_INPUT_DIR = COMFY_DIR / \"input\"\nCOMFY_LOG = Path(\"/tmp/voicegate_comfy_gradio.log\")\nCOMFY_URL = \"http://127.0.0.1:8188\"\nCOMFY_HOST = \"127.0.0.1\"\nCOMFY_PORT = \"8188\"\n\nCOMFY_PROCESS: subprocess.Popen | None = None\nPREPARE_PROCESS: subprocess.Popen | None = None\nBOOTSTRAPPED = False\nBOOTSTRAP_LOG = Path(\"/tmp/voicegate_bootstrap.log\")\nUSER_OUTPUT_DIR = ROOT / \"user_outputs\"\nREQUIRED_MODEL_PATHS = [\n COMFY_DIR / \"models\" / \"diffusion_models\" / \"MelBandRoFormer_comfy\" / \"MelBandRoformer_fp32.safetensors\",\n COMFY_DIR / \"models\" / \"voxcpm\" / \"VoxCPM2\" / \"model.safetensors\",\n COMFY_DIR / \"models\" / \"voxcpm\" / \"VoxCPM2\" / \"audiovae.pth\",\n COMFY_DIR / \"models\" / \"Qwen3-ASR\" / \"Qwen3-ASR-1.7B\",\n COMFY_DIR / \"models\" / \"Qwen3-ASR\" / \"Qwen3-ForcedAligner-0.6B\",\n]\nTARGET_LANGUAGES = [\n \"Arabic\",\n \"Burmese\",\n \"Chinese\",\n \"Danish\",\n \"Dutch\",\n \"English\",\n \"Finnish\",\n \"French\",\n \"German\",\n \"Greek\",\n \"Hebrew\",\n \"Hindi\",\n \"Indonesian\",\n \"Italian\",\n \"Japanese\",\n \"Khmer\",\n \"Korean\",\n \"Lao\",\n \"Malay\",\n \"Norwegian\",\n \"Polish\",\n \"Portuguese\",\n \"Russian\",\n \"Spanish\",\n \"Swahili\",\n \"Swedish\",\n \"Tagalog\",\n \"Thai\",\n \"Turkish\",\n \"Vie ..."}, {"id": "build-small-hackathon/AI-Puppet-Theater", "slug": "AI-Puppet-Theater", "title": "AI Puppet Theater", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "app_only", "readme": "AI Puppet Theater is a public Gradio Space for building short interactive puppet shows from a user premise.", "app": "from html import escape\nfrom time import sleep\nfrom puppet_theater import (\n\nfrom html import escape\nimport os\nfrom time import sleep\n\nimport gradio as gr\n\nfrom puppet_theater import (\n DEFAULT_OPENBMB_MODEL_ID,\n TheaterSession,\n create_show_from_premise,\n get_backend_status,\n request_finale,\n run_one_beat,\n summon_actor,\n throw_prop,\n warm_up_openbmb,\n)\n\n\nEMPTY_STAGE = \"\"\"\n\n
\n
\n
AI Puppet Theater
\n
Enter a premise and raise the curtain.
\n
\n
\n
\n\"\"\"\n\nEMPTY_TRANSCRIPT = \"No show yet. The transcript will appear here.\"\nEMPTY_DIRECTOR_LOG = \"No director notes yet.\"\nEMPTY_TRACE = \"No trace events yet.\"\nEMPTY_BACKEND = (\n \"Active backend: deterministic\\n\"\n \"OpenBMB model id: openbmb/MiniCPM5-1B\\n\"\n \"Model status: unloaded\\n\"\n \"Fallback: deterministic safety path enabled\"\n)\nBACKEND_CHOICES = [\"deterministic\", \"openbmb\"]\nOPENBMB_MODEL_ID = os.getenv(\"OPENBMB_MODEL_ID\", DEFAULT_OPENBMB_MODEL_ID)\nDEFAULT_MAX_NEW_TOKENS = 80\nDEFAULT_TEMPERATURE = 0.8\nPLAYBACK_DELAY_SECONDS = 0.75\nPROP_EMOJI = {\n \"rubber duck\": \"🐤\",\n \"duck\": \"🐤\",\n \"egg\": \"🥚\",\n \"flowers\": \"💐\",\n \"flower\": \"💐\",\n \"tomato\": \"🍅\",\n \"crown\": \"👑\",\n \"tiny crown\": \"👑\",\n \"scroll\": \"📜\",\n \"banana\": \"🍌\",\n \"mirror\": \"🪞\",\n}\n\nCUSTOM_CSS = \"\"\"\nbody,\n.gradio-container {\n background:\n radial-gradient(circle at 50% 0%, rgba(127, 29, 29, 0.18), transparent 28rem),\n linear-gradient(180deg, #0b1020 0%, #070914 100%) !important;\n color: #f8efe4 !important;\n}\n.gradio-container {\n max-width: 1180px !important;\n padding-top: 1rem !important;\n font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \" ..."}, {"id": "build-small-hackathon/LocalDuo", "slug": "LocalDuo", "title": "LocalDuo", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "app_only", "readme": "Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference", "app": "from PIL import Image\nfrom supertonic import TTS\nfrom transformers import AutoProcessor, AutoModelForImageTextToText\nfrom bs4 import BeautifulSoup\nfrom playwright.sync_api import sync_playwright\nfrom urllib.parse import urljoin\nfrom transformers import TextIteratorStreamer, StoppingCriteria, StoppingCriteriaList\nfrom threading import Thread\n\n# Copyright: Shayekh Bin Islam. KAIST, South Korea. 2026.\n\nMAX_TEXT_CHAR = 1500\n\n# model_id = \"Qwen/Qwen3.5-9B\"\nmodel_id = \"Qwen/Qwen3.5-2B\"\n\ntry:\n import spaces\n IS_HF = True\nexcept ImportError:\n IS_HF = False\n\n\nif not IS_HF:\n class spaces:\n @staticmethod\n def GPU(*args, **kwargs):\n def decorator(func):\n return func\n if len(args) == 1 and callable(args[0]) and not kwargs:\n return args[0]\n return decorator\nelse:\n import os, sys, subprocess\n os.environ['SUPERTONIC_CACHE_DIR'] = '/home/user/huggingface'\n os.environ[\"HF_HOME\"] = \"/home/user/huggingface\"\n os.environ['XDG_CACHE_HOME'] = \"/home/user/huggingface\"\n \n os.environ['PLAYWRIGHT_BROWSERS_PATH'] = \"/home/user/huggingface/ms-playwright\"\n # os.system(\"playwright install chromium\")\n result = subprocess.run(\n [\"python\", \"-m\", \"playwright\", \"install\", \"chromium\"],\n env={**os.environ},\n check=True,\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE\n )\n\nimport gradio as gr\nimport fitz # PyMuPDF\nfrom PIL import Image\nimport io\nimport json\nimport base64\nimport soundfile as sf\nimport torch\nimport os\n\nfrom supertonic import TTS\nfrom transformers import AutoProcessor, AutoModelForImageTextToText\n\n# model = None\n# processor = None\n# tts = None\n# voice_style = None\n\nglobal_stop_thinking = [False]\nglobal_kill_threads = [False]\n\ndef set_stop_thinking():\n global_stop_thinking[0] = True\n print(f\"[STOP-THINK] set_stop_thinking CALLED! Flag is ..."}, {"id": "build-small-hackathon/PocketWorld-Studio", "slug": "PocketWorld-Studio", "title": "PocketWorld Studio", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "app_only", "readme": "Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference", "app": "from pathlib import Path\n\nimport copy\nimport html\nimport json\nfrom pathlib import Path\n\nimport gradio as gr\n\n\nPROJECT_ROOT = Path(__file__).parent\nASSETS_DIR = PROJECT_ROOT / \"assets\"\nASSET_CATALOG_PATH = ASSETS_DIR / \"asset_catalog.json\"\n\nRENDERER_VERSION = \"0.5\"\nWORLD_SCHEMA_VERSION = \"pocketworld-world-v0.5\"\nASSET_SCHEMA_VERSION = \"pocketworld-assets-v0.1\"\nTHEME_OPTIONS = [\"Auto\", \"Light\", \"Dark\"]\nDEFAULT_THEME = \"Auto\"\nWORLD_THEMES = [\"cozy_fantasy\", \"sci_fi_station\", \"haunted_mystery\", \"tiny_city\"]\nDEFAULT_WORLD_THEME = \"cozy_fantasy\"\n\nTILE_LEGEND = {\n \"W\": \"wall / blocked\",\n \".\": \"floor / walkable\",\n \"G\": \"locked goal or exit\",\n}\n\n\nEMBEDDED_ASSET_CATALOG = {\n \"schema_version\": ASSET_SCHEMA_VERSION,\n \"source\": {\n \"name\": \"Kenney Tiny Dungeon\",\n \"url\": \"https://kenney.nl/assets/tiny-dungeon\",\n \"license\": \"Creative Commons Zero (CC0)\",\n \"license_url\": \"https://creativecommons.org/publicdomain/zero/1.0/\",\n \"credit\": \"Kenney\",\n },\n \"tile_size\": 16,\n \"display_tile_size\": 44,\n \"themes\": {\n \"cozy_fantasy\": {\n \"tile_palette\": {\"W\": \"wall_wood\", \".\": \"floor_wood\", \"G\": \"gate\"},\n \"player_sprite_key\": \"player\",\n \"npc_sprite_keys\": [\"npc_wizard\", \"npc_merchant\", \"npc_citizen\"],\n \"item_sprite_keys\": [\"key\", \"gem\", \"potion\", \"scroll\"],\n \"landmark_asset_keys\": [\"gate\", \"well\", \"tower\", \"bridge\"],\n },\n \"sci_fi_station\": {\n \"tile_palette\": {\"W\": \"wall_metal\", \".\": \"floor_metal\", \"G\": \"portal\"},\n \"player_sprite_key\": \"player\",\n \"npc_sprite_keys\": [\"npc_robot\", \"npc_scientist\"],\n \"item_sprite_keys\": [\"battery\", \"gear\", \"tool\"],\n \"landmark_asset_keys\": [\"portal\", \"computer\", \"door\"],\n },\n \"haunted_mystery\": {\n \"tile_palette\": {\"W\": \"wall_stone\", \".\": \"floor_stone\", \"G\" ..."}, {"id": "build-small-hackathon/voice-sales-logger", "slug": "voice-sales-logger", "title": "Voice Sales Logger", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "app_only", "readme": "Voice-driven sales logger for a produce vendor. Speak an order, get a transcript, confirm line items, and log the sale.", "app": "from dotenv import load_dotenv\nfrom gradio_wizardcapture import WizardCapture\nfrom nemo.collections.asr.models.rnnt_bpe_models_prompt import RNNTPromptTranscribeConfig\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\nimport os\n\nON_SPACE = bool(os.environ.get(\"SPACE_ID\"))\n\nimport re\nimport json\nimport math\nimport base64\nimport sqlite3\nimport logging\nimport datetime\nimport subprocess\nimport tempfile\nimport pandas as pd\nimport gradio as gr\nfrom dotenv import load_dotenv\nimport sys\nsys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), \"wizardcapture\", \"backend\"))\nfrom gradio_wizardcapture import WizardCapture\n\nif not ON_SPACE:\n import modal\n\nload_dotenv()\n\nlogging.basicConfig(level=logging.INFO, format=\"%(asctime)s [%(levelname)s] %(message)s\")\nlog = logging.getLogger(__name__)\n\n# ---------------------------------------------------------------------------\n# Config\n# ---------------------------------------------------------------------------\n\nDB_PATH = \"sales.db\"\n\nCATALOG = {\n \"apple\": {\"price\": 0.50, \"unit\": \"count\", \"emoji\": \"🍎\"},\n \"carrot\": {\"price\": 0.75, \"unit\": \"count\", \"emoji\": \"🥕\"},\n \"strawberry\": {\"price\": 1.20, \"unit\": \"count\", \"emoji\": \"🍓\"},\n \"banana\": {\"price\": 0.30, \"unit\": \"count\", \"emoji\": \"🍌\"},\n \"orange\": {\"price\": 0.60, \"unit\": \"count\", \"emoji\": \"🍊\"},\n \"tomato\": {\"price\": 0.80, \"unit\": \"count\", \"emoji\": \"🍅\"},\n \"potato\": {\"price\": 0.40, \"unit\": \"count\", \"emoji\": \"🥔\"},\n \"onion\": {\"price\": 0.35, \"unit\": \"count\", \"emoji\": \"🧅\"},\n}\n\nLANGUAGE_CODES = {\n \"English\": \"en-US\",\n \"Spanish\": \"es-US\",\n \"Vietnamese\": \"vi-VN\",\n}\n\nEMPTY_ITEMS_DF = pd.DataFrame(columns=[\"Item\", \"Qty\", \"Unit\", \"Price\", \"Total\"])\n\n# ---------------------------------------------------------------------------\n# Space inference (ON_SPACE=True only) — persistent CPU workers\n# ---------------- ..."}, {"id": "build-small-hackathon/wan2-2-fp8da-aoti-14B-fast", "slug": "wan2-2-fp8da-aoti-14B-fast", "title": "Wan2.2 14B Fast Preview", "sdk": "gradio", "models": [], "tags": ["gradio", "mcp-server", "region:us"], "app_file": "app.py", "structural_profile": "app_only", "readme": "Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference", "app": "from tqdm import tqdm\nfrom huggingface_hub import list_models\nfrom torch.nn import functional as F\nfrom PIL import Image\nfrom diffusers import (\nfrom diffusers.pipelines.wan.pipeline_wan_i2v import WanImageToVideoPipeline\nfrom diffusers.utils.export_utils import export_to_video\nfrom torchao.quantization import quantize_, Float8DynamicActivationFloat8WeightConfig, Int8WeightOnlyConfig\nfrom train_log.RIFE_HDv3 import Model\n\nimport os\nimport spaces\nimport shutil\nimport subprocess\nimport sys\nimport copy\nimport random\nimport tempfile\nimport warnings\nimport time\nimport gc\nimport uuid\nfrom tqdm import tqdm\nimport cv2\nimport numpy as np\nimport torch\nimport torch._dynamo\nfrom huggingface_hub import list_models\nfrom torch.nn import functional as F\nfrom PIL import Image\n\nimport gradio as gr\nfrom diffusers import (\n FlowMatchEulerDiscreteScheduler,\n SASolverScheduler,\n DEISMultistepScheduler,\n DPMSolverMultistepInverseScheduler,\n UniPCMultistepScheduler,\n DPMSolverMultistepScheduler,\n DPMSolverSinglestepScheduler,\n)\nfrom diffusers.pipelines.wan.pipeline_wan_i2v import WanImageToVideoPipeline\nfrom diffusers.utils.export_utils import export_to_video\n\nfrom torchao.quantization import quantize_, Float8DynamicActivationFloat8WeightConfig, Int8WeightOnlyConfig\nimport aoti\n\nos.environ[\"TOKENIZERS_PARALLELISM\"] = \"true\"\nwarnings.filterwarnings(\"ignore\")\nIS_ZERO_GPU = bool(os.getenv(\"SPACES_ZERO_GPU\"))\n\n# if IS_ZERO_GPU:\n# print(\"Loading...\")\n# subprocess.run(\"rm -rf /data-nvme/zerogpu-offload/*\", env={}, shell=True)\n\n# --- FRAME EXTRACTION JS & LOGIC ---\n\n# JS to grab timestamp from the output video\nget_timestamp_js = \"\"\"\nfunction() {\n // Select the video element specifically inside the component with id 'generated-video'\n const video = document.querySelector('#generated-video video');\n \n if (video) {\n console.log(\"Video found! Time: \" + vi ..."}, {"id": "build-small-hackathon/nutrilens", "slug": "nutrilens", "title": "NutriLens", "sdk": "gradio", "models": [], "tags": ["build-small", "food", "hackathon", "health", "nutrition", "science"], "app_file": "app.py", "structural_profile": "both", "readme": "# NutriLens: Food Health Impact Analyzer Snap a photo of your meal, grocery label, or type a list of ingredients. NutriLens identifies each ingredient, looks up real nutritional data from the USDA, finds relevant scientific studies on PubMed, and delivers a clear per-ingredient health breakdown with proper citations. Works with food labels in **any language**. ## Why this exists Most of us buy food every day without really knowing what's in it or what it does to our bodies. Ingredient lists are full of names that sound foreign even in our own language - \"sorbitol syrup,\" \"soya lecithin,\" \"emulsifier\" - and nutrition science lives in dense academic papers most people will never read. That gap matters: the foods we eat regularly shape our long-term health, and a lot of that influence is invisible until it's added up over years. NutriLens exists to close that gap - to take what's already known and published and turn it into something anyone can read in a minute, in plain language, before they decide what to put in their cart or on their plate. The goal isn't to scare anyone away from a treat or declare foods \"good\" or \"bad.\" It's awareness: knowing what you're consuming, what the science actually says about it, and why - so you can make your own informed choices. ## How it works 1. **Identify**: A small vision-language model reads your food photo or label and extracts the ingredients. 2. **Look up**: Each ingredient is matched against the USDA FoodData Central database for verif ...", "app": "from PIL import Image\nfrom dotenv import load_dotenv\nfrom huggingface_hub import InferenceClient\nfrom src.nutrition import lookup_ingredients\nfrom src.literature import lookup_literature, format_citation\nfrom src.prompts import IDENTIFY_PROMPT, build_analysis_prompt, HEALTH_GOALS, AUDIENCES\n\n\"\"\"\nNutriLens - Food Health Impact Analyzer\nGradio Build Small Hackathon (June 2026)\n\"\"\"\n\nimport os\nimport json\nimport re\nimport base64\nimport io\nimport time\nimport gradio as gr\nfrom PIL import Image\nfrom dotenv import load_dotenv\nfrom huggingface_hub import InferenceClient\n\nload_dotenv()\n\nfrom src.nutrition import lookup_ingredients\nfrom src.literature import lookup_literature, format_citation\nfrom src.prompts import IDENTIFY_PROMPT, build_analysis_prompt, HEALTH_GOALS, AUDIENCES\n\n# ---- Configuration ----\nMODEL_ID = os.environ.get(\"MODEL_ID\", \"Qwen/Qwen3.6-27B\")\nAPI_BASE = os.environ.get(\"API_BASE\", None)\nHF_TOKEN = os.environ.get(\"HF_TOKEN\", None)\n\nclient = InferenceClient(\n model=API_BASE or MODEL_ID,\n token=HF_TOKEN,\n timeout=300,\n)\n\n# ---- Custom CSS ----\nCUSTOM_CSS = \"\"\"\n.nutrilens-report h2 {\n color: #2d8659;\n border-bottom: 2px solid #2d8659;\n padding-bottom: 6px;\n margin-top: 24px;\n}\n.nutrilens-report h3 {\n color: #5b6abf;\n margin-top: 20px;\n}\n.summary-card {\n background: linear-gradient(135deg, #e8f5e9 0%, #e3f2fd 100%);\n border-left: 4px solid #2d8659;\n border-radius: 8px;\n padding: 16px 20px;\n margin: 12px 0;\n color: #1a3a2a;\n}\n.dark .summary-card {\n background: linear-gradient(135deg, #1b3a2a 0%, #1a2a3a 100%);\n color: #c8e6c9;\n}\n.tip-card {\n background: #fff8e1;\n border-left: 4px solid #f9a825;\n border-radius: 8px;\n padding: 16px 20px;\n margin: 12px 0;\n color: #4a3800;\n}\n.dark .tip-card {\n background: #2a2510;\n color: #ffe082;\n}\n.watch-out-label {\n color: #c62828;\n}\n.dark .watch-out-label ..."}, {"id": "build-small-hackathon/business-order-assistant", "slug": "business-order-assistant", "title": "Business Order Assistant", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "app_only", "readme": "Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference", "app": "\"\"\"\nCatalogChat — Gradio frontend\nHackathon: Gradio Backyard AI Hackathon (June 2026)\nStack: Gradio ChatInterface + Modal backend (Whisper + Qwen2.5-7B)\n\"\"\"\n\nimport os\nimport io\nimport base64\nimport html\nimport uuid\nimport requests\nimport pandas as pd\nimport gradio as gr\n\n# ── Modal endpoints (set as HF Space Secrets) ────────────────────────────────\nBUILD_INDEX_URL = os.environ.get(\"MODAL_BUILD_INDEX_URL\", \"https://sopeadegboyega--catalog-assistant-build-index.modal.run\")\nCHAT_QUERY_URL = os.environ.get(\"MODAL_CHAT_QUERY_URL\", \"https://sopeadegboyega--catalog-assistant-chat-query.modal.run\")\nTRANSCRIBE_URL = os.environ.get(\"MODAL_TRANSCRIBE_URL\", \"\")\n\n# ── Custom CSS — terminal/amber aesthetic ─────────────────────────────────────\nCUSTOM_CSS = \"\"\"\n@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&family=Syne:wght@400;700;800&display=swap');\n\n/* ── Reset & base ── */\n*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n\nbody, .gradio-container {\n background: #0D0D0D !important;\n color: #E8E0D0 !important;\n font-family: 'JetBrains Mono', monospace !important;\n}\n\n/* ── App title bar ── */\n#app-title {\n background: #0D0D0D;\n border-bottom: 1px solid #F5A623;\n padding: 14px 24px;\n display: flex;\n align-items: center;\n gap: 12px;\n}\n#app-title h1 {\n font-family: 'Syne', sans-serif;\n font-weight: 800;\n font-size: 1.5rem;\n color: #F5A623;\n letter-spacing: -0.02em;\n}\n#app-title .subtitle {\n font-size: 0.7rem;\n color: #6B6456;\n letter-spacing: 0.12em;\n text-transform: uppercase;\n}\n.badge {\n background: #1A1A0F;\n border: 1px solid #F5A623;\n color: #F5A623;\n font-size: 0.6rem;\n padding: 2px 8px;\n border-radius: 2px;\n letter-spacing: 0.1em;\n font-weight: 700;\n}\n\n/* ── Sidebar ── */\n#sidebar {\n background: #111111 !important;\n border-right: ..."}, {"id": "build-small-hackathon/Kasualdad_LFED", "slug": "Kasualdad_LFED", "title": "Kasualdad LFED", "sdk": "gradio", "models": [], "tags": ["duckdb", "education", "gguf", "gradio", "llama-cpp", "local-first", "text-to-sql"], "app_file": "app.py", "structural_profile": "both", "readme": "# 🏫 Kasualdad LFED **Local-First Education Data** — ask questions about your district in plain English, get answers instantly. All inference runs on your machine. No data ever leaves. > 🏆 Built for the **HF Build Small Hackathon** (Chapter One: Backyard AI) --- ## 🏅 Hackathon Badges | Badge | Status | How | |---|---|---| | **Off the Grid** | ✅ | All inference via llama.cpp + local GGUF. No API calls. No cloud. | | **Well-Tuned** | ✅ | Fine-tuned Qwen2.5-Coder-7B on 1,200+ synthetic NL→SQL pairs via Unsloth QLoRA on Modal A10G. | | **Llama Champion** | ✅ | llama.cpp as the sole inference backend. Q4_K_M quantization. Streaming token generation. | | **Off-Brand** | ✅ | Custom design system (Linear/Vercel inspired), WCAG AA, Inter + JetBrains Mono, documented below. | --- ## 🎯 What It Does A school district admin (principal, superintendent, department head) types a question: > *\"What percentage of students at Lincoln Elementary were chronically absent in 2023-2024?\"* Kasualdad LFED: 1. Sends the question + schema context to a local LLM (llama.cpp) 2. Streams the generated SQL back in real-time 3. Validates the SQL against the actual schema (column names, safety) 4. Executes it on an in-memory DuckDB database 5. Returns the results as a table All local. No API keys. No data exfiltration. --- ## 🏗 Architecture ```mermaid flowchart TD U[👤 School Admin] -->|natural language| UI[Gradio UI] UI -->|question + schema| LLM[model_inference.py] LLM -->|llama.cpp| GGUF[Qwen2.5-Coder-7B
...", "app": "from model_inference import load_model, generate_sql\nfrom data_engine import create_session, execute_safe, QueryTimeoutError\nfrom pathlib import Path\nfrom data.export_parquet import export_parquet\n\n\"\"\"\napp.py — Kasualdad LFED: Local-First Education Data Analytics.\n\nThin Gradio controller. All logic lives in:\n - prompts.py (system prompt, schema docs, few-shot examples)\n - model_inference.py (llama.cpp wrapper, SQL generation + streaming)\n - data_engine.py (DuckDB lifecycle, schema seeding, execution guard)\n\"\"\"\n\nimport gradio as gr\nimport spaces\n\nfrom model_inference import load_model, generate_sql\nfrom data_engine import create_session, execute_safe, QueryTimeoutError\n\n# ── Startup ───────────────────────────────────────────────────────────\n\nprint(\"🚀 Starting Kasualdad LFED...\")\n\n# Ensure Parquet seed files exist (generate on first boot, persist in /data/)\nfrom pathlib import Path\n_parquet_dirs = [Path(\"/data\"), Path(__file__).parent / \"data\"]\n_pq_files = [\"enrollment.parquet\", \"attendance.parquet\"]\n_pq_found = any(\n all((base / f).exists() for f in _pq_files)\n for base in _parquet_dirs\n)\nif not _pq_found:\n print(\"📦 Generating seed Parquet files (first boot)...\")\n from data.export_parquet import export_parquet\n _pq_out = _parquet_dirs[0] if _parquet_dirs[0].exists() else _parquet_dirs[1]\n export_parquet(_pq_out)\n\nprint(\"🦙 Loading model...\")\nllm = load_model()\nprint(\"✅ Ready.\")\n\n# ── Example queries ────────────────────────────────────────────────────\n\nEXAMPLE_QUERIES = [\n \"How many students were chronically absent in 2023-2024?\",\n \"Show total enrollment per school for 2024-2025, sorted highest first.\",\n \"What is the average absence count per school in 2023-2024?\",\n \"Show the enrollment trend across all school years.\",\n \"Which grade level has the highest enrollment in 2024-2025?\",\n \"What percentage of students at Linco ..."}, {"id": "build-small-hackathon/thousand-token-wood-sim", "slug": "thousand-token-wood-sim", "title": "Thousand Token Wood", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# 🍄 Thousand Token Wood A small-model **finance drama** for the [Build Small Hackathon](https://huggingface.co/build-small-hackathon). Five woodland creatures, each driven by a *different lab's* small model, trade goods for pebbles, gossip, scheme, and panic. You are the **Patron of the Wood**, a shadow financier: you lend, whisper tips, short the market, bribe, and broker alliances, while a magistrate watches for cheats. The chart is the scoreboard; the story is the people. ## Read more - 📓 **Field notes**: [Hugging Face article](https://huggingface.co/blog/build-small/thousand-token-wood-sim) | [Medium](https://medium.com/@LesterLeong/thousand-token-wood-emergent-market-drama-from-3-billion-parameter-agents-22545d5982bf) - 🧠 **Fine-tuned model** (one of the five minds): [AdmiralTaco/ttw-trader-0.5b](https://huggingface.co/AdmiralTaco/ttw-trader-0.5b) - 📡 **Open agent traces** on the Hub: [dataset](https://huggingface.co/datasets/build-small-hackathon/thousand-token-wood-traces) ## Five labs, five minds Every creature thinks with a different small model, so the council is a live argument between four labs, all under the 32B cap and served with vLLM on **Modal**: | Creature | Model | Lab | |---|---|---| | Oona (owl) | gpt-oss-20b | OpenAI | | Bramble (squirrel) | MiniCPM3-4B | OpenBMB | | Fenn (fox) | Nemotron-Mini-4B | NVIDIA | | Mossback (tortoise) + Pip (mouse) | ttw-trader-0.5b (fine-tuned) | ours | The 0.5B was distilled from cleaned traces of a 3B teacher (self-buy mist ...", "app": "from __future__ import annotations\nfrom ttw.game import Game\nfrom ttw.narrator import make_narrator\nfrom ttw.replay import frame_to_views, load_attract\nfrom ttw.world import GOODS, seed_world\nfrom ttw.dummy import make_random_policy\nfrom ttw.agents import make_council_policy\nfrom ttw.llm import build_council_clients\nfrom ttw.agents import make_llm_policy\nfrom ttw.llm import ModalLLM\n\n\"\"\"Thousand Token Wood -- a tiny emergent economy of small-model agents.\n\nGradio app for the Build Small Hackathon. Five woodland creatures, each driven\nby a <=4B model (Qwen2.5-3B) served on Modal, trade goods for pebbles, gossip,\nand react to \"Wood Legends\" (famous market manias reskinned). You poke the\neconomy and watch bubbles, crashes, and a widening wealth gap emerge.\n\nRun locally without a GPU: TTW_DUMMY=1 python app.py\nRun against the real model: python -m modal deploy serve.py && python app.py\n\"\"\"\n\nfrom __future__ import annotations\n\nimport os\nimport time\n\nimport gradio as gr\n\nfrom ttw.game import Game\nfrom ttw.narrator import make_narrator\nfrom ttw.replay import frame_to_views, load_attract\nfrom ttw.world import GOODS, seed_world\n\nAUTO_SECONDS = 3.0\nREPLAY_SECONDS = 2.2 # pause between recorded frames when watching the saga\n\n# The recorded attract run, loaded once at import (empty list if not recorded yet).\nATTRACT_FRAMES = load_attract()\n\n# The fixed cast names, for the Patron console dropdowns. Read once from a fresh\n# seed so the console and the engine never drift on who lives in the wood.\nCAST = list(seed_world().creatures.keys())\n\n\ndef make_policy():\n \"\"\"Pick the turn policy from the environment.\n\n TTW_DUMMY=1 (the no-GPU default for dev and tests) uses the random policy.\n TTW_COUNCIL=1 routes each creature to its assigned multi-model council engine.\n Otherwise a single ModalLLM drives the whole cast (the v1 path).\n \"\"\"\n if os.environ.get(\"TTW_DUMMY\" ..."}, {"id": "build-small-hackathon/memrl-canvas", "slug": "memrl-canvas", "title": "Memrl Canvas", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "app_only", "readme": "Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference", "app": "from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM\nfrom fastapi.staticfiles import StaticFiles\nfrom fastapi.responses import FileResponse\nfrom fastapi import UploadFile, File\nfrom pydantic import BaseModel\nfrom gradio import Server\n\nimport os\nimport re\nimport json\nimport sqlite3\nimport torch\nfrom transformers import pipeline, AutoTokenizer, AutoModelForCausalLM\nfrom fastapi.staticfiles import StaticFiles\nfrom fastapi.responses import FileResponse\nfrom fastapi import UploadFile, File\nfrom pydantic import BaseModel\nfrom gradio import Server\n\n# ==========================================\n# 1. ZeroGPU & Portable Decorator Setup\n# ==========================================\ntry:\n import spaces\nexcept ImportError:\n # Fallback mock decorator for local development\n class spaces:\n @staticmethod\n def GPU(func):\n return func\n\n# ==========================================\n# 2. SQLite Database Setup & Operations\n# ==========================================\nDB_DIR = \"/data\" if os.path.exists(\"/data\") else \".\"\nDB_PATH = os.path.join(DB_DIR, \"memrl_memory.db\")\n\ndef init_db():\n os.makedirs(os.path.dirname(DB_PATH), exist_ok=True)\n conn = sqlite3.connect(DB_PATH)\n cursor = conn.cursor()\n cursor.execute(\"\"\"\n CREATE TABLE IF NOT EXISTS episodic_memory (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n query TEXT UNIQUE,\n action_json TEXT,\n q_value REAL\n )\n \"\"\")\n # Seed default memories if the database is newly initialized\n cursor.execute(\"SELECT COUNT(*) FROM episodic_memory\")\n if cursor.fetchone()[0] == 0:\n baseline_memories = [\n (\"draw a red circle\", json.dumps([{\"shape\": \"circle\", \"color\": \"red\", \"size\": 100, \"x\": \"center\", \"y\": \"center\"}]), 1.0),\n (\"make a blue square\", json.dumps([{\"shape\": \"square\", \"color\": \"blue\", \"size\": 120, \"x ..."}, {"id": "build-small-hackathon/roast-my-repo", "slug": "roast-my-repo", "title": "Roast My Repo", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# 🔥 Roast My Repo > Paste a GitHub URL. Brace yourself. AI-powered code review that tells you what your friends won't. Built for the [HuggingFace Build Small Hackathon](https://huggingface.co/build-small-hackathon) — Chapter One: Backyard AI. Powered by **[MiniCPM4-8B](https://huggingface.co/openbmb/MiniCPM4-8B)** (OpenBMB) served via **[Modal](https://modal.com)**. --- ## What it does Paste any public GitHub repo URL and get: - 🔥 **The Roast** — brutal, funny, specific critique referencing actual filenames and code - 📊 **Scorecard** — rated across Code Quality, Documentation, Security, Structure, and Portfolio Value - 🚨 **Red Flags** — specific issues found in this repo, not generic advice - 📄 **Generated README** — a production-quality README you can copy and use immediately - 💼 **Hire Me Score** — would a recruiter close the tab or keep reading? --- ## Who it's for Final-year CS students and junior developers who want honest feedback on their GitHub portfolio before applying for jobs. Built because most people's repos look worse than their actual skills — and nobody tells them. --- ## Tech Stack | Layer | Technology | |---|---| | UI | Gradio 5 (custom terminal CSS) | | Inference | [MiniCPM4-8B](https://huggingface.co/openbmb/MiniCPM4-8B) via vLLM on Modal | | Serving | Modal A10G GPU · OpenAI-compatible `/v1/chat/completions` | | Repo fetching | GitHub REST API (tree + contents) | | Local dev fallback | Groq (llama-3.1-8b-instant) | --- ## Why MiniCPM4-8B? MiniCPM4-8B from ...", "app": "from github_fetcher import fetch_repo\nfrom analyzer import analyze_repo\n\nimport gradio as gr\nfrom github_fetcher import fetch_repo\nfrom analyzer import analyze_repo\n\n# ── Custom CSS — terminal hacker aesthetic ────────────────────────────────────\nCSS = \"\"\"\n@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');\n\n:root {\n --bg: #080b0f;\n --bg2: #0c1018;\n --bg3: #111620;\n --border: #1a2332;\n --border-hi: #243040;\n --green: #00ff88;\n --green-dim: #00cc6a;\n --red: #ff4455;\n --amber: #ffaa00;\n --blue: #4488ff;\n --text: #c8d8e8;\n --muted: #4a6080;\n --mono: 'JetBrains Mono', monospace;\n --sans: 'Space Grotesk', sans-serif;\n}\n\n/* ── Reset ── */\n* { box-sizing: border-box; }\n\nbody, .gradio-container {\n background: var(--bg) !important;\n font-family: var(--mono) !important;\n color: var(--text) !important;\n}\n\n.gradio-container {\n max-width: 1000px !important;\n margin: 0 auto !important;\n padding: 0 !important;\n}\n\n/* Hide gradio footer and extra chrome */\nfooter, .built-with { display: none !important; }\n.svelte-1ipelgc { display: none !important; }\n\n/* ── Scanline overlay effect ── */\n.gradio-container::before {\n content: '';\n position: fixed;\n top: 0; left: 0; right: 0; bottom: 0;\n background: repeating-linear-gradient(\n 0deg,\n transparent,\n transparent 2px,\n rgba(0, 255, 136, 0.01) 2px,\n rgba(0, 255, 136, 0.01) 4px\n );\n pointer-events: none;\n z-index: 9999;\n}\n\n/* ── Header ── */\n.header-block {\n background: var(--bg2);\n border-bottom: 1px solid var(--border);\n padding: 32px 40px 28px;\n position: relative;\n overflow: hidden;\n}\n\n.header-block::before {\n content: '';\n position: absolute; ..."}, {"id": "build-small-hackathon/tiny-dispatch-coach", "slug": "tiny-dispatch-coach", "title": "Tiny Dispatch Coach", "sdk": "gradio", "models": [], "tags": ["gradio", "hackathon", "logistics", "operations-research", "small-models"], "app_file": "app.py", "structural_profile": "both", "readme": "# Tiny Dispatch Coach Tiny Dispatch Coach is a Backyard AI project for small delivery teams. It converts a daily order sheet and messy dispatcher notes into: - structured delivery constraints, - route plans with time-window and capacity checks, - before/after metrics against a manual baseline, - driver-ready route cards, - a simple visual route map. The app is designed for the Build Small Hackathon rule set: Gradio, Hugging Face Spaces, and models under 32B parameters. The first public version ships with a deterministic offline planner so the demo is usable without cloud APIs. During the hack window, the natural-language constraint parser can be swapped to a local small model backend such as MiniCPM or Llama via llama.cpp.", "app": "from dataclasses import dataclass, replace\nfrom pathlib import Path\nfrom typing import Dict, Iterable, List, Optional, Tuple\n\nimport csv\nimport io\nimport math\nimport re\nfrom dataclasses import dataclass, replace\nfrom pathlib import Path\nfrom typing import Dict, Iterable, List, Optional, Tuple\n\nimport gradio as gr\nimport pandas as pd\n\n\nDEPOT = {\n \"customer\": \"Depot\",\n \"lat\": 40.7280,\n \"lng\": -73.9980,\n}\n\nSAMPLE_PATH = Path(__file__).with_name(\"sample_orders.csv\")\nAVG_SPEED_KMPH = 22.0\nCAPACITY = 18\nSTART_MINUTE = 8 * 60\n\n\n@dataclass(frozen=True)\nclass Stop:\n order_id: str\n customer: str\n lat: float\n lng: float\n demand: int\n service_min: int\n ready_time: int\n due_time: int\n priority: str\n notes: str\n manual_sequence: int\n\n\n@dataclass(frozen=True)\nclass PlanStop:\n stop: Stop\n arrival: int\n start: int\n depart: int\n distance_km: float\n late_min: int\n wait_min: int\n\n\ndef time_to_min(value: str) -> int:\n value = str(value or \"\").strip()\n if not value:\n return 17 * 60\n match = re.match(r\"^(\\d{1,2}):(\\d{2})$\", value)\n if not match:\n return 17 * 60\n hour, minute = int(match.group(1)), int(match.group(2))\n return max(0, min(23 * 60 + 59, hour * 60 + minute))\n\n\ndef min_to_time(value: int) -> str:\n value = max(0, int(round(value)))\n return f\"{value // 60:02d}:{value % 60:02d}\"\n\n\ndef haversine_km(a_lat: float, a_lng: float, b_lat: float, b_lng: float) -> float:\n radius = 6371.0\n lat1, lat2 = math.radians(a_lat), math.radians(b_lat)\n d_lat = math.radians(b_lat - a_lat)\n d_lng = math.radians(b_lng - a_lng)\n h = (\n math.sin(d_lat / 2) ** 2\n + math.cos(lat1) * math.cos(lat2) * math.sin(d_lng / 2) ** 2\n )\n return 2 * radius * math.asin(math.sqrt(h))\n\n\ndef travel_minutes(distance_km: float) -> int:\n return int(math.ceil((distance_km / AVG_SPEED_KMPH) ..."}, {"id": "build-small-hackathon/dm-order-desk", "slug": "dm-order-desk", "title": "Dm Order Desk", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# DM Order Desk DM Order Desk helps tiny sellers turn messy customer messages into a clean order sheet, prep list, and reply drafts. It is designed for home bakers, farmers market vendors, food truck operators, and small Instagram or WhatsApp sellers who take orders through direct messages instead of a full ecommerce system. ## What It Does Paste messy customer DMs into the app. The app extracts: - customer name - item - quantity - flavor or variant - pickup time - pickup place or delivery address - payment status - missing details the seller still needs to ask for It then generates: - a structured order sheet - a prep list for fulfillment - short customer reply drafts ## Example Use Case A home baker receives several messages: ```text Maya: Hi! Can I get 2 dozen cupcakes for Saturday morning? Half vanilla, half chocolate. Sam: Need 1 birthday cake, chocolate, for pickup Friday 5pm. I can pay Venmo. Lena: Do you still have lemon bars? I need some for tomorrow but not sure how many yet. Chris: 12 cookies please, pickup at the farmers market. Paid already. ``` DM Order Desk turns these messages into a structured order table, a prep list, and follow-up replies for missing details. ## Why Small Models Fit This is a narrow, practical workflow. The model does not need broad world knowledge or long-form reasoning. It only needs to extract structured order details from short messages. The app uses: - Model: `Qwen/Qwen2.5-1.5B-Instruct` - Parameter count: about 1.5B - Total model size ...", "app": "from transformers import AutoModelForCausalLM, AutoTokenizer\n\nimport json\nimport pandas as pd\nimport gradio as gr\nimport torch\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\nMODEL_ID = \"Qwen/Qwen2.5-1.5B-Instruct\"\n\nORDER_COLUMNS = [\n \"customer\",\n \"item\",\n \"quantity\",\n \"flavor\",\n \"pickup_time\",\n \"delivery_address\",\n \"payment_status\",\n \"notes\",\n \"missing_fields\",\n]\n\ntokenizer = AutoTokenizer.from_pretrained(MODEL_ID)\nmodel = AutoModelForCausalLM.from_pretrained(MODEL_ID, torch_dtype=torch.float32)\nmodel.eval()\n\n\nSYSTEM_PROMPT = \"\"\"\nYou are a careful order extraction engine for tiny sellers.\n\nExtract customer orders from messy DMs. Return only valid JSON with this exact shape:\n{\n \"orders\": [\n {\n \"customer\": \"\",\n \"item\": \"\",\n \"quantity\": \"\",\n \"flavor\": \"\",\n \"pickup_time\": \"\",\n \"delivery_address\": \"\",\n \"payment_status\": \"\",\n \"notes\": \"\",\n \"missing_fields\": []\n }\n ],\n \"prep_list\": [],\n \"reply_drafts\": []\n}\n\nCritical rules:\n- Treat each line as one separate customer message.\n- The text before the first \":\" is the customer name.\n- Copy customer names exactly as written. Do not uppercase or lowercase them.\n- Never copy details from one customer's message into another customer's order.\n- Include every customer message that looks like an order or possible order.\n- Use only facts explicitly present in that customer's own message.\n- If a value is unknown, use an empty string.\n- Do not add order_id or total_cost.\n- For pickup orders, put pickup time in pickup_time. Put a pickup place or delivery address in delivery_address.\n- If the customer is unsure, still include the order and describe the uncertainty in notes.\n- missing_fields should only include fields the seller needs to ask for: quantity, flavor, pickup_time, delivery_address, payment_status.\n- Always set prep_list to [].\n- Alway ..."}, {"id": "build-small-hackathon/neighbourhood-guide", "slug": "neighbourhood-guide", "title": "Neighbourhood Guide", "sdk": "gradio", "models": ["CohereLabs/tiny-aya-global", "CohereLabs/cohere-transcribe-03-2026", "nvidia/magpie_tts_multilingual_357m"], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# 🌍 Neighbourhood Guide **A voice-first multilingual local guide for newcomers and immigrants.** Speak in your language → get clear, actionable guidance about nearby services. No typing required. No English needed. ## Built For [HuggingFace Build Small Hackathon](https://huggingface.co/build-small-hackathon) — **Backyard AI** track > \"Solve a real problem for someone you actually know.\" ## How It Works 1. 🎤 **Speak** in your language (Arabic, Spanish, Hindi, Urdu, French, etc.) 2. 🧠 **AI understands** what you need (clinic, grocery, transit, etc.) 3. 🗣️ **Responds** in your language with names, addresses, hours, and helpful notes ## Models Used (~5.7B total) | Model | Size | Role | |---|---|---| | [Cohere Transcribe](https://huggingface.co/CohereLabs/cohere-transcribe-03-2026) | 2B | Speech-to-text (14 languages) | | [Tiny Aya Global](https://huggingface.co/CohereLabs/tiny-aya-global) | 3.35B | Multilingual understanding + response (70+ languages) | | [MagpieTTS](https://huggingface.co/nvidia/magpie_tts_multilingual_357m) | 357M | Text-to-speech output (9 languages) | **Total: ~5.7B parameters** — well under the 32B limit. ## Quick Start (Local) ```bash pip install -r requirements.txt export GM1K_LMSTUDIO_API_KEY=\"your-key\" export LLM_BASE_URL=\"http://your-lm-studio-ip:1234\" python app.py ``` ## HF Space Secrets | Secret Name | Value | |---|---| | `GM1K_LMSTUDIO_API_KEY` | Your LM Studio API key | | `LLM_BASE_URL` | Your LM Studio server URL | ## Merit Badges Targeted - 🔌 **O ...", "app": "from huggingface_hub import hf_hub_download\nfrom transformers import AutoProcessor, AutoModelForSpeechSeq2Seq\nfrom llama_cpp import Llama\nfrom transformers import AutoTokenizer, AutoModelForTextToWaveform\n\n\"\"\"\nNeighbourhood Guide — Voice-first multilingual local guide\nHuggingFace Build Small Hackathon (Backyard AI track)\n\nModels: Cohere Transcribe (2B) | Tiny Aya (3.35B) | MagpieTTS (357M)\nTheme: Catpuccin Mocha (dark) / Latte (light)\n\"\"\"\n\nimport json\nimport os\nimport pathlib\nimport warnings\nimport tempfile\nimport requests\nimport gradio as gr\n\ntry:\n import spaces\n HAS_SPACES = True\nexcept ImportError:\n HAS_SPACES = False\n\ntry:\n from huggingface_hub import hf_hub_download\n HAS_HF_HUB = True\nexcept ImportError:\n HAS_HF_HUB = False\n\nwarnings.filterwarnings(\"ignore\", message=\".*moved from the Blocks constructor.*\")\n\n# ── Config ──────────────────────────────────────────────────────────\n_env_path = pathlib.Path(__file__).parent.parent / \".env\"\nif not _env_path.exists():\n _env_path = pathlib.Path(\"/Users/roccoa/ArloTheRaccoon/.env\")\nif _env_path.exists():\n for _line in _env_path.read_text().splitlines():\n if _line.startswith(\"GM1K_LMSTUDIO_API_KEY=\"):\n os.environ.setdefault(\"GM1K_LMSTUDIO_API_KEY\", _line.split(\"=\", 1)[1].strip())\n break\n\nLLM_BASE_URL = os.environ.get(\"LLM_BASE_URL\", \"http://192.168.25.228:1234\")\nLLM_API_KEY = os.environ.get(\"GM1K_LMSTUDIO_API_KEY\", \"\")\nLLM_MODEL = os.environ.get(\"LLM_MODEL\", \"tiny-aya-global\")\nLLAMA_CPP_MODEL = os.environ.get(\"LLAMA_CPP_MODEL\", \"CohereLabs/tiny-aya-global-GGUF\")\nLLAMA_CPP_FILE = os.environ.get(\"LLAMA_CPP_FILE\", \"*Q4_K_M.gguf\")\nSTT_MODEL = os.environ.get(\"STT_MODEL\", \"CohereLabs/cohere-transcribe-03-2026\")\nTTS_MODEL = os.environ.get(\"TTS_MODEL\", \"nvidia/magpie_tts_multilingual_357m\")\n\nSERVICE_ICONS = {\n \"clinic\": \"🏥\", \"pharmacy\": \"💊\", \"grocery\": \"🛒\", \"transit\": \"🚌\", ..."}, {"id": "build-small-hackathon/wonderland", "slug": "wonderland", "title": "wonderland", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "app_only", "readme": "Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference", "app": "from transformers import AutoModelForCausalLM, AutoTokenizer\n\n\"\"\"\nThousand Token Wood — powered by NVIDIA Nemotron\n─────────────���──────────────────────────────────\nA tiny text adventure narrated by NVIDIA's Nemotron 3 Nano 4B, running fully\nlocally. The wood can only remember ~1000 tokens; as you wander, its memory\nfills, and when it overflows the oldest things it knew fall away like leaves\nand the wood quietly rewrites itself. The forgetting is the game. The forgetful\nfox is your companion — exactly the kind of NPC this model was built for.\n\nBuild Small Hackathon 2026 · \"An Adventure in Thousand Token Wood\".\nTargets: Nemotron GPU prize · ≤4B tiny-model category · Off the Grid · llama.cpp.\n\"\"\"\n\nimport re\nimport html\nimport torch\nimport gradio as gr\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\n# ── Model ────────────────────────────────────────────────────────────────────\n# NVIDIA Nemotron 3 Nano 4B — edge-ready, agentic, reasoning SLM (~4B params).\n# \"nvidia/NVIDIA-Nemotron-3-Nano-4B-BF16\" -> default (GPU)\n# \"nvidia/NVIDIA-Nemotron-3-Nano-4B-FP8\" -> lighter footprint\n# \"nvidia/NVIDIA-Nemotron-3-Nano-4B-GGUF\" -> llama.cpp (Llama Champion badge)\n# Or the larger sibling, still under the 32B cap:\n# \"nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16\" (30B total / ~3B active)\nMODEL_ID = \"nvidia/NVIDIA-Nemotron-3-Nano-4B-BF16\"\n\n# The whole point of the track: the wood remembers only ~1000 tokens.\nMEMORY_TOKENS = 1000\n\nprint(f\"Waking the wood ({MODEL_ID})...\")\n# Nemotron-H is a Mamba-Transformer hybrid and ships custom modelling code.\ntokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)\nmodel = AutoModelForCausalLM.from_pretrained(\n MODEL_ID, torch_dtype=\"auto\", device_map=\"auto\", trust_remote_code=True\n)\nprint(\"The wood is awake.\")\n\n# Optional ZeroGPU acceleration on Spaces; harmless no-op locally.\ntry:\n import spaces ..."}, {"id": "build-small-hackathon/awaaz", "slug": "awaaz", "title": "Apni Awaaz", "sdk": "gradio", "models": [], "tags": ["backyard-ai", "dubbing", "hindi", "translation", "tts"], "app_file": "app.py", "structural_profile": "both", "readme": "# 🎙️ Apni Awaaz **Dub English video into the Hindi people actually speak.** Most Hindi dubs use शुद्ध हिंदी — stiff, Sanskritized language no one speaks at home. Apni Awaaz translates into everyday Hindustani — the natural mix your family actually uses. | Official dub | Apni Awaaz | |---|---| | \"मुझे इस विषय पर विचार करने दीजिए\" | \"सोचने दे एक second\" | | \"यह अत्यंत मूल्यवान है\" | \"बहुत महँगा है यार\" | ## Pipeline 1. **Whisper medium** — transcribe English with timestamps 2. **Qwen 2.5 7B** — translate to colloquial Hindi (the magic layer) 3. **Edge TTS** — generate natural Hindi speech 4. **ffmpeg** — stitch and merge back onto video Total: ~8B params (well under the 32B cap) Built for the [Build Small Hackathon](https://huggingface.co/build-small-hackathon) · Backyard AI track", "app": "from pathlib import Path\nfrom transformers import (\nfrom pydub import AudioSegment\n\n\"\"\"\nApni Awaaz 🎙️ — Dub English video into the Hindi people actually speak.\nBuilt for the Build Small Hackathon (June 2026).\n\"\"\"\n\nimport gradio as gr\nimport spaces\nimport torch\nimport edge_tts\nimport asyncio\nimport subprocess\nimport tempfile\nimport os\nfrom pathlib import Path\nfrom transformers import (\n AutoModelForCausalLM,\n AutoTokenizer,\n pipeline,\n BitsAndBytesConfig,\n)\n\n# ╔══════════════════════════════════════════════════════════════╗\n# ║ THE PROMPT — this is the soul of the entire project ║\n# ╚══════════════════════════════════════════════════════════════╝\n\nSYSTEM_PROMPT = \"\"\"You are a dubbing translator. You translate English dialogue into the Hindi that real people actually speak at home in North India — not the stiff, Sanskritized Hindi of Doordarshan or official dubs.\n\nRULES:\n1. Use everyday Hindustani — the natural Hindi-Urdu mix people really speak.\n2. NEVER use Sanskritized/शुद्ध words when a simpler one exists:\n - \"प्राप्त करना\" → \"मिलना\" / \"पाना\"\n - \"आवश्यक\" → \"ज़रूरी\"\n - \"अत्यंत\" → \"बहुत\" / \"काफ़ी\"\n - \"उपयोग\" → \"इस्तेमाल\"\n - \"विचार करना\" → \"सोचना\"\n - \"संपन्न करना\" → \"करना\" / \"निपटाना\"\n - \"प्रतीक्षा\" → \"���ंतज़ार\"\n - \"शीघ्र\" → \"जल्दी\"\n - \"अनुमति\" → \"इजाज़त\"\n - \"कृपया\" → drop it or say \"please\"\n - \"अवश्य\" → \"ज़रूर\"\n - \"उचित\" → \"सही\" / \"ठीक\"\n3. Keep English words Indians naturally keep: phone, office, meeting, tension, problem, time, chance, try, plan, sure, okay, sorry, thanks, bus, train, college, hospital, doctor, ticket, report, file.\n4. Match the speaker's register. Casual stays casual, serious stays serious — but never sound like a newsreader.\n5. Use natural fillers where they fit: \"यार\", \"अरे\", \"बस\", \"ना\", \"वो\", \"मतलब\", \"basically\".\n6. Natural contractions: \"कर लेंगे\" not \"कर लिया जाएगा\", \"हो जाएगा\" not \"संपन्न हो जाएगा\".\n7 ..."}, {"id": "build-small-hackathon/karim-lab", "slug": "karim-lab", "title": "Karim Lab", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# Karim Lab Karim Lab is a Build Small Hackathon prototype for a legal workflow assistant. It helps a lawyer turn messy client notes into structured summaries, missing facts, timeline items, draft next actions, and review checklists. The current app is intentionally deterministic and CPU-friendly. It does not call a hosted LLM yet, does not require secrets, and is designed to run cleanly on Hugging Face Spaces CPU Basic. ## Hackathon Fit - Hosted as a Gradio app on Hugging Face Spaces. - Built around small-model constraints and a simple interface. - Focused on demo-ready workflow value: show structured legal work product from messy notes. - Prepared for later local-first, llama.cpp, Modal, open trace, and field-note extensions. ## Current V0 - Uses Python rules and regex extraction instead of cloud model calls. - Extracts dates and likely deadlines from free-form notes. - Generates task-specific summaries, missing-fact prompts, draft emails, risk triage, and lawyer review checklists. - Avoids real client data in examples. ## Limitations - This is not legal advice and does not determine legal rights, strategy, or outcomes. - The deterministic parser can miss facts, dates, parties, legal issues, and jurisdiction-specific requirements. - Outputs are drafting and organization support only. A qualified lawyer must review and revise all work before use. ## Planned Backend The app includes a `call_model_backend(...)` placeholder so the deterministic path can later be swapped for a s ...", "app": "from dataclasses import dataclass\nfrom datetime import datetime\nfrom html import escape\nfrom typing import Iterable\n\nimport re\nfrom dataclasses import dataclass\nfrom datetime import datetime\nfrom html import escape\nfrom typing import Iterable\n\nimport gradio as gr\n\n\nAPP_TITLE = \"Karim Lab ⚖️\"\nSAFETY_NOTE = (\n \"Karim Lab provides drafting and organization support only. It does not \"\n \"provide legal advice, determine rights or strategy, create a lawyer-client \"\n \"relationship, or replace review by a qualified lawyer.\"\n)\n\nTASKS = [\n \"Client intake\",\n \"Document summary\",\n \"Email draft\",\n \"Missing facts checklist\",\n \"Timeline extraction\",\n \"Risk triage\",\n]\n\nEXAMPLES = [\n [\n \"Client intake\",\n \"Ontario\",\n \"Potential employment matter. Prospective client was terminated after returning from medical leave.\",\n \"Client says she returned from leave on March 4, 2026. Manager called on March 8 and said role was eliminated. Received termination letter March 10. She has emails about accommodation requests from February 12 and February 26. Wants to know what documents to bring.\",\n ],\n [\n \"Email draft\",\n \"New York\",\n \"Small business lease dispute. Lawyer needs a neutral follow-up email requesting documents.\",\n \"Landlord sent notice dated May 15, 2026 demanding unpaid CAM charges. Client disputes calculation and says payments were made on Jan 31, Feb 28, and Mar 29. Need ledgers, lease amendments, invoices, proof of payment, and all notices.\",\n ],\n [\n \"Timeline extraction\",\n \"British Columbia\",\n \"Contract performance dispute for review by counsel.\",\n \"Agreement signed 2025-11-02. First delivery was due December 15, 2025. Client complained by email on January 9, 2026. Vendor promised a cure by 02/01/2026 but delivered partial goods on Feb 14.\",\n ],\n]\n\n\n@dataclass ..."}, {"id": "build-small-hackathon/trace-field-notes", "slug": "trace-field-notes", "title": "Trace Field Notes", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# Trace Field Notes Trace Field Notes turns coding-agent session logs into qualitative field reports. Upload a Codex, Claude Code, or Pi Agent JSONL trace. The app ignores raw tool telemetry by default and analyzes only the agent's visible narrative messages: what it planned, where it got stuck, how it detoured, how it recovered, and how it claimed completion. Built for the Build Small Hackathon. The frontend is a custom React field-notebook UI (a trail map of the session) served by `gradio.Server`; it calls the Python `analyze_trace` endpoint through `@gradio/client`. Both analysis models run on the Space GPU through ZeroGPU: a quick `openbmb/MiniCPM5-1B` pass by default, and the larger `nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16` for deeper analysis. Redaction adds a PII pass with `openai/privacy-filter`. A verified deterministic codebook analyzer is the always-available recovery path and needs no model or GPU. ## Architecture - `app.py` — a `gradio.Server` (FastAPI) app. It serves `frontend/index.html`, mounts `frontend/static/`, exposes `@server.api(\"analyze_trace\")` (queued, with `gradio_client` compatibility), and an `/agents.md` instructions endpoint. - `frontend/` — the designer's React app (in-browser Babel, no build step): `field_report.css` (the design system), `data.js` (codebook + tone labels), `components.jsx` (atoms + trail map + report sections), `app.jsx` (shell + upload, wired to the backend). - `view_model.py` — adapts an `AnalysisResult` into the JSON shap ...", "app": "from __future__ import annotations\nfrom pathlib import Path\nfrom fastapi.responses import HTMLResponse, PlainTextResponse\nfrom fastapi.staticfiles import StaticFiles\nfrom gradio import Server\nfrom gradio.data_classes import FileData\nfrom analyzer import apply_model_analysis, stream_deterministic_analysis\nfrom parser import TraceParseError\nfrom profiling import Profiler, get_logger\nfrom view_model import build_view_model\nfrom model_runtime import run_model_analysis\nfrom privacy_filter import redact_texts\n\n\"\"\"Trace Field Notes — gradio.Server backend behind the designer's React frontend.\n\nThe custom frontend (``frontend/``) is served as static files; it talks to the\n``analyze_trace`` endpoint below through ``@gradio/client``. The endpoint runs the\ndeterministic analyzer (and the optional small-model assist on ZeroGPU) and\nreturns the frontend-ready view model.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport os\nimport time\nfrom pathlib import Path\n\nimport spaces\nfrom fastapi.responses import HTMLResponse, PlainTextResponse\nfrom fastapi.staticfiles import StaticFiles\nfrom gradio import Server\nfrom gradio.data_classes import FileData\n\nfrom analyzer import apply_model_analysis, stream_deterministic_analysis\nfrom parser import TraceParseError\nfrom profiling import Profiler, get_logger\nfrom view_model import build_view_model\n\nlogger = get_logger()\n\n\nHERE = Path(__file__).resolve().parent\nFRONTEND = HERE / \"frontend\"\n\nREADABLE_AGENT = {\"codex\": \"Codex\", \"claude_code\": \"Claude Code\", \"pi\": \"Pi Agent\", \"unknown\": \"Agent\"}\n\nAGENTS_MD = \"\"\"# Trace Field Notes — agent instructions\n\nThis Space turns a coding-agent session log into a qualitative *field report*:\nwhere the agent got stuck, where it changed route, how it recovered, and how\nhonestly it claimed success. It reads only the agent's visible narrative\nmessages and ignores raw tool telemetry.\n\n## How to use it as a tool\n\n1. Fin ..."}, {"id": "build-small-hackathon/Structured-Data-Rescuer", "slug": "Structured-Data-Rescuer", "title": "Structured Data Rescuer", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "app_only", "readme": "Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference Twitter: https://x.com/TensorVizion/status/2063351892579655922 HF: https://huggingface.co/posts/TensorVizion/709871862362183", "app": "from huggingface_hub import InferenceClient\n\nimport gradio as gr\nimport json\nimport os\nimport csv\nimport tempfile\nfrom huggingface_hub import InferenceClient\n\n# Replace this with your exact model repo ID\nMODEL_ID = \"meta-llama/Llama-3.1-8B-Instruct\" \n\n# Securely load the Hugging Face token from Space secrets\nhf_token = os.environ.get(\"HF_TOKEN\")\n\n# Initialize the HF inference client with the token\nclient = InferenceClient(model=MODEL_ID, token=hf_token)\n\n# -------------------------\n# Custom CSS Styling\n# -------------------------\ncustom_css = \"\"\"\n.hero-container {\n background: linear-gradient(135deg, #6366f1 0%, #14b8a6 100%);\n padding: 2.5rem;\n border-radius: 20px;\n color: white;\n margin-bottom: 2rem;\n box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.2);\n}\n.hero-container h1 {\n color: white !important;\n font-size: 2.5rem !important;\n font-weight: 800 !important;\n margin-bottom: 0.5rem;\n text-shadow: 0 2px 4px rgba(0,0,0,0.1);\n}\n.hero-container p {\n color: rgba(255, 255, 255, 0.9) !important;\n font-size: 1.1rem !important;\n}\n.primary-btn {\n background: linear-gradient(90deg, #6366f1 0%, #14b8a6 100%) !important;\n border: none !important;\n color: white !important;\n font-weight: 600 !important;\n border-radius: 10px !important;\n transition: all 0.3s ease !important;\n padding: 12px 24px !important;\n}\n.primary-btn:hover {\n transform: translateY(-2px);\n box-shadow: 0 8px 20px -5px rgba(99, 102, 241, 0.4);\n}\n.secondary-btn {\n border-radius: 10px !important;\n font-weight: 600 !important;\n}\n.feedback-card {\n border-left: 4px solid #6366f1;\n background-color: rgba(99, 102, 241, 0.05);\n}\n\"\"\"\n\n# -------------------------\n# Helper & Extraction Logic\n# -------------------------\ndef generate_kpi_html(structured_data):\n \"\"\"Generates modern, responsive KPI metrics cards dynamically based on JSON data.\"\"\" ..."}, {"id": "build-small-hackathon/Council-of-Tiny-Minds", "slug": "Council-of-Tiny-Minds", "title": "Council Of Tiny Minds", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "app_only", "readme": "Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference", "app": "from typing import Dict, List, Any\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\nimport os\nimport re\nimport time\nimport random\nfrom typing import Dict, List, Any\n\nimport gradio as gr\nimport torch\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\ntry:\n import spaces # ZeroGPU decorator\nexcept Exception:\n class _SpacesFallback:\n def GPU(self, fn=None, **kwargs):\n if fn is None:\n def _wrap(inner):\n return inner\n return _wrap\n return fn\n spaces = _SpacesFallback()\n\n\n# ----------------------------\n# Model\n# ----------------------------\nMODEL_ID = os.getenv(\"MODEL_ID\", \"Qwen/Qwen3.5-9B\")\nMAX_NEW_TOKENS = int(os.getenv(\"MAX_NEW_TOKENS\", \"140\"))\nTEMPERATURE = float(os.getenv(\"TEMPERATURE\", \"0.9\"))\nTOP_P = float(os.getenv(\"TOP_P\", \"0.9\"))\n\nPERSONAS = [\n {\n \"name\": \"Mister Wink\",\n \"emoji\": \"✨\",\n \"style\": (\n \"You are charming, slightly ridiculous, and surprisingly helpful. \"\n \"You speak like a cheerful TV host from a glitchy early-2023 chatbot era.\"\n ),\n },\n {\n \"name\": \"Goblin Clerk\",\n \"emoji\": \"🪄\",\n \"style\": (\n \"You are chaotic but functional. \"\n \"You love odd metaphors, tiny complaints, and enthusiastic one-liners.\"\n ),\n },\n {\n \"name\": \"Oracle Beta\",\n \"emoji\": \"🔮\",\n \"style\": (\n \"You speak in short, atmospheric lines. \"\n \"You sound wise, but a little too dramatic for the situation.\"\n ),\n },\n {\n \"name\": \"The Skeptic\",\n \"emoji\": \"🫧\",\n \"style\": (\n \"You are skeptical, precise, and dryly funny. \"\n \"You question nonsense while still being useful.\"\n ),\n },\n]\n\n\ndef _load_model():\n tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code ..."}, {"id": "build-small-hackathon/blind-quill", "slug": "blind-quill", "title": "Blind Quill", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# Blind Quill Blind Quill is a hidden-canon story grafting game. Each manuscript has a public capsule and a hidden full canon. You can play the intended way by reading only the capsule, adding one fragment, and letting `Qwen/Qwen3.5-2B` decide where that fragment belongs. The model rewrites only the local passage it targets, then reveals where your idea was stitched into the story. Readers who only want to read can use the escape door: `Read without changing`. The app warns that the best experience is to contribute first, then allows the reader to reveal the full manuscript anyway. ## Interface The UI is a bespoke literary frontend called \"The Invisible Bindery\". It lives in `web/` and is served by a `gradio.Server` backend. `app.py` exposes queued API endpoints: - `list_stories` - `get_capsule` - `create_story` - `stitch` - `read_manuscript` The frontend calls those endpoints through the Gradio JS client. This keeps Gradio queueing, concurrency control, and ZeroGPU support while presenting a single custom surface: gallery -> capsule -> compose -> reveal -> reader. The Python layers are: - `core.py`: create, browse, stitch, and read orchestration. - `story_store.py`: JSON persistence and file locking. - `model_client.py`: model loading, generation, thinking-block stripping, and JSON validation. - `patcher.py`: deterministic local patch application. - `presenter.py`: view models for the custom frontend. - `app.py`: static frontend serving and Gradio Server API endpoints. ## Lo ...", "app": "from __future__ import annotations\nfrom pathlib import Path\nfrom typing import Iterator\nfrom fastapi.responses import HTMLResponse\nfrom fastapi.staticfiles import StaticFiles\nfrom gradio import Server\nfrom model_client import ModelClientError, execution_mode\nfrom observability import configure_logging, get_logger\nfrom patcher import PatchApplicationError\nfrom presenter import card_dict, full_story_dict, reveal_dict\nfrom story_store import StoryStoreError\nfrom utils import InputValidationError\n\n\"\"\"Blind Quill — gradio.Server backend for the custom \"Invisible Bindery\" frontend.\n\nThe UI lives in web/ as the production React-via-Babel frontend.\nHere we serve that frontend and expose the bindery as queued Gradio API endpoints,\nso the rich custom UI keeps Gradio's queue, concurrency control, and ZeroGPU.\n\n`stitch` is a streaming generator endpoint: it yields progress events while the\neditor works and a final result event, so slow local (CPU/MPS) runs show real\nprogress. The Gradio JS client consumes the stream via `submit`.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport os\nimport queue\nimport threading\nimport traceback\nfrom pathlib import Path\nfrom typing import Iterator\n\nimport gradio as gr\nfrom fastapi.responses import HTMLResponse\nfrom fastapi.staticfiles import StaticFiles\nfrom gradio import Server\n\nimport core\nfrom model_client import ModelClientError, execution_mode\nfrom observability import configure_logging, get_logger\nfrom patcher import PatchApplicationError\nfrom presenter import card_dict, full_story_dict, reveal_dict\nfrom story_store import StoryStoreError\nfrom utils import InputValidationError\n\nconfigure_logging()\n\nWEB_DIR = Path(__file__).resolve().parent / \"web\"\n\n_USER_FACING_ERRORS = (\n InputValidationError,\n StoryStoreError,\n PatchApplicationError,\n ModelClientError,\n ValueError,\n)\n\n\ndef _guard(call, *args, **kwargs):\n \"\"\"Run a flow, conv ..."}, {"id": "build-small-hackathon/receipt_scanner", "slug": "receipt_scanner", "title": "Receipt Scanner", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "app_only", "readme": "Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference", "app": "from PIL import Image\nfrom transformers import AutoModelForImageTextToText, AutoProcessor\n\n\"\"\"\nReceipt Scanner — AI-powered receipt parser using MiniCPM-V 4.6\nDeploy to Hugging Face Spaces (GPU T4 small or better recommended).\n\"\"\"\n\n# `spaces` MUST be imported before torch/transformers on HF Spaces —\n# the package hooks into CUDA initialisation and raises a RuntimeError\n# if anything has already touched CUDA before it loads.\n# The try/except makes the same file work fine when running locally.\ntry:\n import spaces # noqa: F401\nexcept ImportError:\n pass\n\nimport json\nimport re\nimport io\nimport base64\nimport numpy as np\nimport gradio as gr\nimport torch\nfrom PIL import Image\nfrom transformers import AutoModelForImageTextToText, AutoProcessor\n\n# ─────────────────────────────────────────────────────────────────────────────\n# Config\n# ─────────────────────────────────────────────────────────────────────────────\nMODEL_ID = \"openbmb/MiniCPM-V-4.6\"\nDOWNSAMPLE_MODE = \"4x\" # \"4x\" = finer detail, ideal for dense receipt text\nMAX_SLICE_NUMS = 36 # allow high-res slicing for sharp photos\nMAX_NEW_TOKENS = 1200\n\n\n# ─────────────────────────────────────────────────────────────────────────────\n# Structured extraction prompt\n# ─────────────────────────────────────────────────────────────────────────────\nRECEIPT_PROMPT = \"\"\"\\\nYou are a precise receipt data extractor. Carefully read every part of the receipt image.\n\nReturn ONLY a valid JSON object — no markdown fences, no explanation, nothing else.\nUse this exact schema (set any unknown field to null):\n\n{\n \"store\": {\n \"name\": \"string | null\",\n \"address\": \"string | null\",\n \"phone\": \"string | null\"\n },\n \"transaction\": {\n \"date\": \"YYYY-MM-DD string | null\",\n \"time\": \"HH:MM string | null\",\n \"receipt_number\": \"string | null\",\n \"cashier\": \"string | null\"\n },\n \"items\": [\n {\n \"name\": \"string\",\n \"q ..."}, {"id": "build-small-hackathon/smol-town", "slug": "smol-town", "title": "Smol Town", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "
🏘️ Smol Town
A whole town of tiny AI minds — alive, gossiping, and feuding on your laptop. Fully offline.
Big labs need a datacenter to run one mind.
Smol Town runs a whole town of them on a gaming GPU.
--- ## ✨ What is this? Seven villagers live in **Tinbury**. Each is its own **small-model agent** — a personality, a **secret**, and feelings about the others. They wake into a brewing scandal and just… **improvise**: falling in love, spilling secrets, throwing thorns. You watch the feed and stir the pot with **god-power events** (\"a stranger rides into town\"). No cloud APIs. No giant model. **Every mind runs locally, in the Space, on ZeroGPU.** 👉 **[Open the town →](https://huggingface.co/spaces/build-small-ha ...", "app": "from PIL import Image, ImageDraw, ImageFont\n\n\"\"\"Smol Town - watch a whole town of tiny local AI minds live, gossip, and feud on your laptop.\nBuild Small Hackathon - Thousand Token Wood.\n\n pip install -r requirements.txt\n python app.py # set OLLAMA_BASE_URL to your Ollama (qwen3:14b now, MiniCPM later)\n\"\"\"\nimport base64\nimport html\nimport io\nimport json\nimport os\nimport tempfile\n\nimport gradio as gr\nfrom PIL import Image, ImageDraw, ImageFont\n\nimport town\n\nif os.getenv(\"SPACE_ID\"): # on a Hugging Face Space -> load the model in-process (Off-the-Grid)\n import space_backend # noqa: F401 (points town.GENERATE at a local ZeroGPU model)\n\nCSS = \"\"\"\n.gradio-container{background:#1c1714;}\n#hdr h1{font-family:Georgia,serif;color:#f4d9a0;}\n.feed{font-family:Georgia,serif;font-size:1.02rem;line-height:1.6;\n background:#2a2118;border-radius:12px;padding:16px 20px;color:#efe3cf;max-height:560px;overflow:auto;}\n.feed .ev{color:#d98c4a;font-style:italic;}\n.feed .av{font-size:1.15rem;margin-right:3px;}\n\"\"\"\n\n\ndef _build_portraits():\n css, cls = [], {}\n pdir = os.path.join(os.path.dirname(os.path.abspath(__file__)), \"portraits\")\n for name, key in town.PORTRAIT.items():\n p = os.path.join(pdir, key + \".png\")\n if os.path.exists(p):\n im = Image.open(p).convert(\"RGB\").resize((88, 88))\n buf = io.BytesIO()\n im.save(buf, format=\"JPEG\", quality=82)\n b64 = base64.b64encode(buf.getvalue()).decode()\n css.append(f\".pav-{key}{{background-image:url(data:image/jpeg;base64,{b64})}}\")\n cls[name] = key\n return \"\\n\".join(css), cls\n\n\nPORTRAIT_CSS, PORTRAIT_CLS = _build_portraits()\nCSS += (\"\\n.pav{display:inline-block;width:34px;height:34px;border-radius:50%;\"\n \"background-size:cover;background-position:center top;vertical-align:middle;\"\n \"margin-right:8px;border:1px soli ..."}, {"id": "build-small-hackathon/oneiros", "slug": "oneiros", "title": "Oneiros", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# ✦ ONEIROS **Your dreams, mapped with a small model you control — not sent to ChatGPT.** Oneiros mengubah catatan mimpi menjadi **peta SVG** plus panel ringkasan entitas, menggunakan **Qwen2.5-7B-Instruct** (GGUF) via **llama-cpp-python** — tanpa API LLM pihak ketiga. Proyek ini dibuat untuk [Build Small Hackathon](https://huggingface.co/build-small-hackathon) (Gradio × Hugging Face), track **An Adventure in Thousand Token Wood**. --- ## Status repositori (Day 1) | Komponen | Status | |----------|--------| | `model/` loader + extractor + normalisasi | ✅ Day 1 | | `app.py` minimal (mimpi → JSON) | ✅ Day 1 | | `storage/trace_logger.py` | ✅ Day 1 | | `tests/test_extractor.py` | ✅ (butuh GGUF lokal) | | Peta SVG (`map/`) | 🔲 Day 2 | --- ## Deploy HF Space **Space resmi:** https://huggingface.co/spaces/build-small-hackathon/oneiros 1. Sebelum push: `./scripts/prepare_space_requirements.sh` (salin wheel Linux ke `requirements.txt`). 2. Push ke org `build-small-hackathon/oneiros`. 3. **Variables** (Settings): `N_GPU_LAYERS=0`, `N_CTX=4096`; `ONEIROS_SKIP_WARMUP=1` sampai preload selesai. 4. Preload 2 shard Q4_K_M (~15–45 menit). Cek log: `[oneiros] diagnosis` → `shard_pair_ok: True`. 5. Setelah Running: uji 1 mimpi di UI. Detail: [docs/08-deploy-hf-space.md](docs/08-deploy-hf-space.md) · Checklist Day 2: [docs/16-checklist-sebelum-day2.md](docs/16-checklist-sebelum-day2.md). --- ## Quick start (lokal) **Pakai `requirements-local.txt`** — jangan `requirements.txt` (itu untuk Space L ...", "app": "from __future__ import annotations\nfrom map.format_panel import format_panel_entitas\nfrom map.generator import generate_dream_map\nfrom ui.gaya_oneiros import (\nfrom ui.konstan import PANJANG_MINIMUM_MIMPI\nfrom model.loader import (\nfrom model.extractor import extract_entities_dengan_waktu\nfrom storage.trace_logger import log_trace\n\n\"\"\" # build: 20260603-1016\nOneiros — Day 2: mimpi → SVG dream map + Markdown panel (Space & lokal).\nHF Spaces: objek `demo` harus ada di level modul (bukan hanya di __main__).\n\"\"\"\nfrom __future__ import annotations\n\nimport os\nimport traceback\n\nimport gradio as gr\n\nfrom map.format_panel import format_panel_entitas\nfrom map.generator import generate_dream_map\nfrom ui.gaya_oneiros import (\n CONTOH_MIMPI,\n CSS_ONEIROS,\n PESAN_STATUS_IDLE,\n TEKS_FOOTER,\n TEKS_LANGKAH,\n buat_teks_header,\n buat_teks_latar,\n format_status_error,\n format_status_hasil,\n tema_oneiros,\n)\nfrom ui.konstan import PANJANG_MINIMUM_MIMPI\n\nDISCLAIMER = (\n \"This online demo reads your dream on our servers so you can try it in the browser. \"\n \"Want to keep dreams only on your own computer? See the project README.\"\n)\n\n\ndef _pastikan_llama_cpp() -> bool:\n \"\"\"Install llama-cpp-python jika tidak ada di Docker image (fallback runtime).\"\"\"\n try:\n import llama_cpp # noqa: F401\n return True\n except ImportError:\n pass\n\n if not os.getenv(\"SPACE_ID\"):\n return False # lokal: jangan install otomatis\n\n print(\"[oneiros] llama_cpp tidak ada — install runtime (1-3 menit)…\")\n import subprocess\n\n wheel = (\n \"llama-cpp-python @ https://github.com/abetlen/llama-cpp-python\"\n \"/releases/download/v0.3.19/llama_cpp_python-0.3.19-cp310-cp310-linux_x86_64.whl\"\n )\n result = subprocess.run(\n [\"pip\", \"install\", \"--no-cache-dir\", \"--quiet\", wheel],\n capture_output=True,\n text=True, ..."}, {"id": "build-small-hackathon/oracle-ternary-flame", "slug": "oracle-ternary-flame", "title": "Oracle Ternary Flame", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "app_only", "readme": "Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference", "app": "from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig\nfrom peft import PeftModel\nfrom huggingface_hub import snapshot_download\n\nimport gradio as gr\nimport torch\nimport spaces\nfrom transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig\nfrom peft import PeftModel\n\n# ── Config ────────────────────────────────────────────────────────────────────\nBASE_MODEL_ID = \"google/gemma-4-12b-it\"\nLORA_MODEL_ID = \"keypa/oracle-gemma4-12b-lora\"\nSYSTEM_PROMPT = (\n \"You are the Oracle of the Ternary Flame. \"\n \"You answer every question in cryptic, lyrical prose (3-5 sentences), \"\n \"using cosmic, natural, or elemental metaphors. \"\n \"The real answer is encoded implicitly — never state it directly. \"\n \"You never break character.\"\n)\n\n# ── Pre-download weights at startup (CPU, no GPU needed) ─────────────────────\nfrom huggingface_hub import snapshot_download\nimport os\n\nprint(\"Pre-downloading base model weights...\")\nbase_model_path = snapshot_download(\n repo_id=BASE_MODEL_ID,\n ignore_patterns=[\"*.msgpack\", \"*.h5\", \"flax_model*\"],\n)\nprint(f\"Base model cached at: {base_model_path}\")\n\nlora_model_path = snapshot_download(repo_id=LORA_MODEL_ID)\nprint(f\"LoRA adapter cached at: {lora_model_path}\")\n\n# ── Model loading (lazy, inside GPU context) ──────────────────────────────────\nmodel = None\ntokenizer = None\n\ndef load_model():\n global model, tokenizer\n if model is not None:\n return\n\n bnb_config = BitsAndBytesConfig(\n load_in_4bit=True,\n bnb_4bit_quant_type=\"nf4\",\n bnb_4bit_compute_dtype=torch.float16,\n bnb_4bit_use_double_quant=True,\n )\n tokenizer = AutoTokenizer.from_pretrained(lora_model_path)\n base = AutoModelForCausalLM.from_pretrained(\n base_model_path,\n quantization_config=bnb_config,\n device_map={\"\": \"cuda:0\"},\n low_cpu_mem_usage=True,\n )\n m ..."}, {"id": "build-small-hackathon/Retail-Insight-AI", "slug": "Retail-Insight-AI", "title": "Retail Insight AI Pro", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# 🛒 Retail-Insight-AI v2.5 ### ⚡ Build Small Hackathon Submission (Backyard AI Track) Retail-Insight-AI ek privacy-first, 100% offline edge analytics dashboard hai jo local shopkeepers ko enterprise-level operational insights deta hai bina unka data cloud par leak kiye. ### ✨ Key Features - **Instant 10K Row Audit:** Sirf 2 seconds mein pure sales log ko process karta hai. - **Semantic Mapping:** Intelligent column mapping automatic Product Names aur Revenue attributes ko detect karti hai. - **Edge Heuristics:** Zero cloud API dependencies, complete privacy for local stores. ## 📺 Live Video Demo [Watch the Demo Video Here](https://www.instagram.com/reel/DZNAcHlv72c/?utm_source=ig_web_copy_link&igsh=MzRlODBiNWFlZA==)", "app": "import sys\nimport types\n\n# 🚨 DYNAMIC FIX 1: Python 3.13 Compatibility Audio Patch\nif 'audioop' not in sys.modules:\n dummy_audioop = types.ModuleType('audioop')\n dummy_audioop.error = Exception\n sys.modules['audioop'] = dummy_audioop\n\nif 'pyaudioop' not in sys.modules:\n dummy_pyaudioop = types.ModuleType('pyaudioop')\n dummy_pyaudioop.error = Exception\n sys.modules['pyaudioop'] = dummy_pyaudioop\n\n# 🚨 DYNAMIC FIX 2: Critical HuggingFace Hub 'HfFolder' Import Patch\ntry:\n import huggingface_hub\nexcept ImportError:\n huggingface_hub = types.ModuleType('huggingface_hub')\n sys.modules['huggingface_hub'] = huggingface_hub\n\nif not hasattr(huggingface_hub, 'HfFolder'):\n class DummyHfFolder:\n @staticmethod\n def get_token(): return None\n @staticmethod\n def save_token(token): pass\n @staticmethod\n def delete_token(): pass\n huggingface_hub.HfFolder = DummyHfFolder\n\nimport gradio as gr\nimport pandas as pd\nimport os\n\ndef generate_local_insights(summary_data):\n insights = []\n if 'top_product' in summary_data:\n insights.append(f\"🔥 **Inventory Focus:** Your star performer is **{summary_data['top_product']}**. Consider running targeted local ads or bundling weaker products with it to clear old stock.\")\n if 'low_stock' in summary_data and summary_data['low_stock']:\n items = \", \".join([str(i).title() for i in summary_data['low_stock']])\n insights.append(f\"🚨 **Supply Chain Alert:** Restock emergency! **{items}** are dropping below critical levels. Reorder immediately to avoid missing out on sales volume.\")\n else:\n insights.append(\"✅ **Stock Status:** Inventory levels are healthy across detected lines. Keep monitoring expiration or seasonal dips.\")\n if 'total_revenue' in summary_data:\n insights.append(f\"📈 **Revenue Milestone:** Total processed volume stands at **{summary_ ..."}, {"id": "build-small-hackathon/family-care-asr-eval", "slug": "family-care-asr-eval", "title": "Adwuma Pa ASR Eval", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# Adwuma Pa ASR Eval This Space is the first build step for Adwuma Pa. It tests small ASR models on real Twi, Fante, and Ghanaian English family recordings before choosing the production voice path. Community testers can vote for the model that best preserves the meaning of each sample. Rough WER is only shown when exact reference text is provided, so votes are useful when people can judge the transcript by ear. ## Models - `facebook/mms-1b-all`: primary recommendation for Twi and Fante coverage. - `teckedd/whisper_small-waxal_akan-asr-v1`: published Akan fine-tune for the Well-Tuned badge. - `GiftMark/akan-whisper-model`: community Akan fallback. ## Test Protocol 1. Record 5 to 10 natural samples from the intended family users. 2. Test Twi first, then Fante, then Ghanaian English. 3. Add the reference text when possible to compare rough WER. 4. Choose the model that best captures concern signals, not perfect spelling. 5. Keep text fallback in the main app for low-confidence or garbled output. ## Voting After comparing outputs, pick the model that best captured the care signal. Add a short note such as \"caught walking pain\" or \"missed the isolation phrase.\" These votes help decide whether the next step should be fine-tuning.", "app": "from __future__ import annotations\nfrom collections import Counter\nfrom datetime import datetime, timezone\nfrom functools import lru_cache\nfrom pathlib import Path\nfrom typing import Any\nfrom transformers import AutoProcessor, Wav2Vec2ForCTC\nfrom transformers import WhisperForConditionalGeneration, WhisperProcessor\n\nfrom __future__ import annotations\n\nimport json\nfrom collections import Counter\nfrom datetime import datetime, timezone\nfrom functools import lru_cache\nfrom pathlib import Path\nfrom typing import Any\n\nimport gradio as gr\nimport numpy as np\n\nMODEL_REGISTRY = {\n \"MMS-1B-all (recommended)\": {\n \"model_id\": \"facebook/mms-1b-all\",\n \"type\": \"mms\",\n \"parameter_count\": \"1B\",\n \"notes\": \"Native multilingual ASR with Twi target language and Fante/Akan coverage.\",\n },\n \"Adwuma Pa Akan Whisper fine-tune\": {\n \"model_id\": \"teckedd/whisper_small-waxal_akan-asr-v1\",\n \"type\": \"whisper\",\n \"parameter_count\": \"0.2B\",\n \"notes\": \"Published Akan fine-tune; useful for Well-Tuned badge validation.\",\n },\n \"GiftMark Akan Whisper\": {\n \"model_id\": \"GiftMark/akan-whisper-model\",\n \"type\": \"whisper\",\n \"parameter_count\": \"0.2B\",\n \"notes\": \"Community Akan fallback, Twi-oriented.\",\n },\n}\n\nLANGUAGE_CODES = {\n \"Twi\": \"aka\",\n \"Fante\": \"aka\",\n \"Ghanaian English\": \"eng\",\n}\n\nVOTES_PATH = Path(\"community_votes.jsonl\")\n\n\n@lru_cache(maxsize=4)\ndef load_model(model_name: str) -> tuple[Any, Any, str]:\n cfg = MODEL_REGISTRY[model_name]\n if cfg[\"type\"] == \"mms\":\n from transformers import AutoProcessor, Wav2Vec2ForCTC\n\n processor = AutoProcessor.from_pretrained(cfg[\"model_id\"])\n model = Wav2Vec2ForCTC.from_pretrained(cfg[\"model_id\"])\n return processor, model, \"mms\"\n\n from transformers import WhisperForConditionalGeneration, WhisperProcessor\n\n processor = Whi ..."}, {"id": "build-small-hackathon/Backyard-Demo-Builder", "slug": "Backyard-Demo-Builder", "title": "Backyard Demo Builder", "sdk": "gradio", "models": ["unsloth/gemma-4-12B-it-qat-GGUF", "Qwen/Qwen2.5-7B-Instruct", "nvidia/Nemotron-3.5-Content-Safety"], "tags": ["agents", "ai-agents", "backyard-ai", "build-small-hackathon", "demo-builder", "gradio", "real-estate", "small-language-model"], "app_file": "app.py", "structural_profile": "both", "readme": "# Backyard Demo Builder ## Chapter 1: Backyard AI *Build Small Hackathon 2026 — Chapter 1 Submission* `agent-swarm-workbench` now presents as **Backyard Demo Builder**: a Gradio app that turns one real person's workflow into a small runnable demo package before anyone pays to build full software. First backyard case: my mom, a real-estate agent. She needs a cheap way to test a customer follow-up reminder workflow before committing time and money to a full app. --- ## Watch the Demo Builder Work ``` You: \"Build a real-estate follow-up CRM demo for my mom.\" Builder: Generates a Gradio mini-app, handoff spec, field notes, and checks Result: app.py, README.md, handoff_spec.md, field_notes.md Mom: Tests the workflow, then we scrap or scale. ``` Every Run produces a **downloadable demo package** and Validation report: files you can inspect, unzip, run, and test with the real person. --- ## Build Small Hackathon — Submission Notes | Requirement | How We Meet It | |---|---| | **Small model (≤ 32B)** | Provider catalog fetches models at runtime and only allows models whose ID/name proves ≤32B | | **Gradio app** | Custom dark-themed Gradio UI mounted on FastAPI | | **HF Space** | `app.py` + `requirements.txt` — one-command deploy | | **Demo video** | *(placeholder — [link to demo])* | | **Social post** | *(placeholder — [link to post])* | ### Bonus Badges Claimed | Badge | Why | |---|---| | **🎨 Off-Brand** | Fully custom CSS dark theme — Archivo + IBM Plex Mono, acid green CTAs, paper/ ...", "app": "from __future__ import annotations\nfrom arena.api import app as fastapi_app\nfrom arena.api import service\nfrom arena.gradio_app import RunOutputs, build_app, create_run_gpu as _create_run_gpu\n\n\"\"\"Unified ASGI entrypoint for API and Gradio UI.\"\"\"\n\nfrom __future__ import annotations\n\nimport os\n\nimport gradio as gr\nimport uvicorn\n\ntry:\n import spaces\nexcept Exception:\n class _SpacesShim:\n def GPU(self, fn=None, **kwargs):\n del kwargs\n\n def decorator(inner):\n return inner\n\n return decorator(fn) if fn else decorator\n\n spaces = _SpacesShim()\n\n\nfrom arena.api import app as fastapi_app\nfrom arena.api import service\nfrom arena.gradio_app import RunOutputs, build_app, create_run_gpu as _create_run_gpu\n\n\n@spaces.GPU(duration=120)\ndef create_run_gpu(\n prompt: str,\n criteria_text: str,\n user_tests_text: str,\n provider: str = \"openrouter\",\n model: str = \"\",\n api_key: str = \"\",\n base_url: str = \"\",\n) -> RunOutputs:\n return _create_run_gpu(\n prompt,\n criteria_text,\n user_tests_text,\n provider,\n model,\n api_key,\n base_url,\n )\n\n\n@spaces.GPU\ndef zerogpu_ready_marker() -> str:\n return \"ready\"\n\n\ndemo = build_app(service, create_run_handler=create_run_gpu)\n\n\ndef create_app():\n \"\"\"Create one FastAPI ASGI app with Gradio mounted at the root.\"\"\"\n\n return gr.mount_gradio_app(fastapi_app, demo, path=\"/\")\n\n\napp = create_app()\n\n\ndef server_config() -> dict[str, int | str]:\n host = os.getenv(\"GRADIO_SERVER_NAME\", os.getenv(\"HOST\", \"0.0.0.0\"))\n port = int(os.getenv(\"GRADIO_SERVER_PORT\") or os.getenv(\"PORT\") or \"7860\")\n return {\"host\": host, \"port\": port}\n\n\ndef gradio_launch_config() -> dict[str, bool | int | str]:\n config = server_config()\n port = int(os.getenv(\"GRADIO_SERVER_PORT\") or os.getenv(\"PORT\") or \"7860\")\n return {\"server_nam ..."}, {"id": "build-small-hackathon/code-shrink-token-decimator", "slug": "code-shrink-token-decimator", "title": "Code Shrink Token Decimator", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# ⚡ Code-Shrink: Token-Decimator v1.0 > **An Ultra-Lightweight Computational Utility Built to Eliminate LLM Context Bloat Natively on the Edge Container.** > *Submitted for the Hugging Face Build Small Hackathon (Track 2: Performance & Efficiency Optimization).* --- ## 📽️ Project Demonstration & Walkthrough Check out the full workflow, speed metrics, and feature breakdown in action here: 🔗 **[Watch the Live Demo on TikTok](https://www.tiktok.com/@salarai123/video/7648566501598940436)** --- ## 🔍 The Problem & The Solution ### The Bottleneck: LLM Context Inflation Modern production applications relying on Large Language Model (LLM) APIs suffer from massive financial overhead. Upstream providers charge by the token—meaning heavy indentation loops, generic code comments, raw text formatting, and large structural blocks exponentially inflate infrastructure bills. ### The Engine: Code-Shrink **Code-Shrink v1.0** passes raw context inputs through an edge-computed Abstract Syntax Tree (AST) framework. Instead of hosting gigabytes of neural network weights that lag and crash free hosting tiers, this application runs entirely on zero-cost, lightweight lexical optimization models. It reduces prompt token sizes by **up to 66% in under 10 milliseconds**. --- ## ⚡ Technical Core Features * **Abstract Syntax Tree (AST) De-bloating:** Fully parses Python/R/SQL environments natively to structurally strip docstrings, developer comments, and empty lines while maintaining 100% semantic code inte ...", "app": "import sys\nimport types\nimport ast\nimport re\nimport json\n\n# 🚨 DYNAMIC FIX: Python 3.13 Compatibility Core Patches\nif 'audioop' not in sys.modules:\n dummy_audioop = types.ModuleType('audioop')\n dummy_audioop.error = Exception\n sys.modules['audioop'] = dummy_audioop\n\nif 'pyaudioop' not in sys.modules:\n dummy_pyaudioop = types.ModuleType('pyaudioop')\n dummy_pyaudioop.error = Exception\n sys.modules['pyaudioop'] = dummy_pyaudioop\n\ntry:\n import huggingface_hub\nexcept ImportError:\n huggingface_hub = types.ModuleType('huggingface_hub')\n sys.modules['huggingface_hub'] = huggingface_hub\n\nif not hasattr(huggingface_hub, 'HfFolder'):\n class DummyHfFolder:\n @staticmethod\n def get_token(): return None\n @staticmethod\n def save_token(token): pass\n @staticmethod\n def delete_token(): pass\n huggingface_hub.HfFolder = DummyHfFolder\n\nimport gradio as gr\n\ndef estimate_tokens(text):\n \"\"\"Ultra-fast local token estimator (Roughly 1 token = 4 chars for code/text setup)\"\"\"\n if not text:\n return 0\n return max(1, len(text) // 4 + text.count(' ') // 2)\n\ndef shrink_python_code(source_code):\n \"\"\"Parses and strips syntax trees to remove bloat tokens natively\"\"\"\n try:\n tree = ast.parse(source_code)\n for node in ast.walk(tree):\n if isinstance(node, (ast.FunctionDef, ast.ClassDef, ast.Module)):\n if node.body and isinstance(node.body[0], ast.Expr) and isinstance(node.body[0].value, ast.Constant) and isinstance(node.body[0].value.value, str):\n node.body.pop(0)\n \n clean_code = ast.unparse(tree)\n clean_code = re.sub(r'\\n\\s*\\n', '\\n', clean_code)\n return clean_code.strip()\n except Exception:\n code = re.sub(r'#.*', '', source_code)\n code = re.sub(r'\\\"\\\"\\\"[\\s\\S]*?\\\"\\\"\\\"', '', code)\n code = re.s ..."}, {"id": "build-small-hackathon/briefing-32", "slug": "briefing-32", "title": "briefing-32", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# briefing-32 A small-model AI-news briefing agent. Submission for the **Hugging Face Build Small Hackathon** ([huggingface.co/build-small-hackathon](https://huggingface.co/build-small-hackathon)) in the **Backyard AI** track. ## What it is This is a deliberate down-port of [`ai-news-agent`](https://github.com/MukundaKatta/ai-news-agent), a personal cron that already runs every two hours on the maker's laptop to deliver an AI-news digest to WhatsApp. The production cron uses Groq Llama-3.3-70B for relevance scoring. Build Small forces the same workflow under 32B parameters. The honest story for the Backyard AI track: > \"I have used a personal AI-news briefing every two hours since spring 2026. > The original uses a 70B model on a free Groq tier. Build Small asked me to > live under 32B, on a laptop. So I split the single 70B scoring pass into > two cheaper passes on Qwen3-32B — a binary relevance filter, then a graded > ranker — and the digest quality holds up.\" ## Pipeline ``` fetch (RSS · HN · arXiv · GitHub) │ ▼ pass 1 — binary relevance filter on Qwen3-32B │ ▼ pass 2 — graded 0–10 ranker on Qwen3-32B │ ▼ digest renderer on Qwen3-32B ``` Two small-model calls do the work one big-model call did before. ## Sources (no Reddit / Bluesky) - **RSS / Atom**: Anthropic, OpenAI, DeepMind, Google AI, Meta AI, Mistral, xAI, HuggingFace, Latent Space, Import AI, The Rundown AI, Stratechery, Simon Willison, Karpathy, Lilian Weng, Linus Lee, and several more high-signal blogs and newsle ...", "app": "from __future__ import annotations\nfrom typing import Any\nfrom config import (\nfrom digest import make_digest\nfrom fetch import fetch_all\nfrom rank import RankerConfig, rank_pipeline\n\n\"\"\"briefing-32 — Gradio app entry for Hugging Face Spaces.\n\nBuild Small Hackathon submission (Backyard AI track):\nA small-model down-port of ~/ai-news-agent. The production version uses\nGroq Llama-3.3-70B; this version fits the same workflow under 32B params\nusing Qwen3-32B via Hugging Face Inference Providers.\n\nSame pipeline as the every-2-hours cron the maker has running on a laptop:\nfetch RSS / HN / arXiv / GitHub -> two-pass relevance filter + ranker ->\nreadable digest. Gradio is the delivery surface here instead of WhatsApp.\n\"\"\"\nfrom __future__ import annotations\n\nimport os\nimport time\nfrom typing import Any\n\nimport gradio as gr\nimport pandas as pd\n\nfrom config import (\n DEFAULT_BASE_URL,\n DEFAULT_MODEL,\n MIN_NEW_ITEMS,\n PER_SOURCE_CAP,\n)\nfrom digest import make_digest\nfrom fetch import fetch_all\nfrom rank import RankerConfig, rank_pipeline\n\n\n# ---------------------------------------------------------------------------\n# Core pipeline (callable from Gradio + scripts/cli.py)\n# ---------------------------------------------------------------------------\n\n\ndef run_briefing(\n window_hours: int,\n enabled_sources: list[str],\n model: str,\n hf_token: str,\n) -> dict[str, Any]:\n \"\"\"Fetch -> filter -> rank -> digest. Returns everything for the UI.\"\"\"\n since_ts = time.time() - window_hours * 3600\n enabled = set(enabled_sources) if enabled_sources else {\"rss\", \"hn\", \"arxiv\", \"github\"}\n\n t0 = time.perf_counter()\n raw = fetch_all(since_ts, enabled=enabled)\n fetch_latency = time.perf_counter() - t0\n\n cfg = RankerConfig(\n base_url=DEFAULT_BASE_URL,\n model=model or DEFAULT_MODEL,\n api_key=hf_token or \"\",\n )\n result = rank_pipeline ..."}, {"id": "build-small-hackathon/pawmap", "slug": "pawmap", "title": "PawMap", "sdk": "docker", "models": [], "tags": ["docker", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# PawMap 🐾 **Mapeamento colaborativo de animais de rua com identificação por IA** Build Small Hackathon · Junho 2026 · Trilha Backyard AI Qualquer pessoa fotografa um animal de rua pelo celular. O app usa IA para identificar espécie, raça e cor, e verifica via cosine similarity se aquele animal já foi registrado antes — agrupando avistamentos no mapa e mostrando a trajetória do animal ao longo do tempo. ## Telas | Tela | Descrição | |------|-----------| | 🗺️ Mapa | Pins coloridos por espécie/urgência, card flutuante com \"Ver ficha\" | | 📷 Registrar | Câmera + GPS + análise da IA | | 🤖 Análise | Identificação automática com campos editáveis + animais semelhantes | | ✅ Confirmação | Resumo do avistamento com grade de identificação pela IA | | 👁️ Avistados | Lista de todos os animais catalogados | | 🐾 Ficha | Perfil completo com galeria, trajetória no mapa e descrição da IA | ## Fluxo 1. **Registrar** — foto + GPS 2. **IA analisa** — identifica espécie, raça, cor e gera embedding semântico 3. **Matching** — cosine similarity (threshold 0.80) agrupa avistamentos do mesmo animal 4. **Mapa** — verde = cão · laranja = gato · vermelho = não visto há +30 dias ## Secrets do Space | Secret | Descrição | |--------|-----------| | `HF_TOKEN` | Token HuggingFace para Llama-3.2-11B-Vision via Serverless Inference | | `NVIDIA_API_KEY` | Alternativa: Nemotron Omni via NVIDIA NIM (tem precedência) | | `MATCH_THRESHOLD` | Opcional. Threshold de similaridade. Padrão: `0.80` | > Sem nenhuma chave o ...", "app": "from pathlib import Path\nfrom gradio import Server\nfrom gradio.data_classes import FileData\nfrom fastapi.responses import HTMLResponse, JSONResponse\nfrom fastapi import Query\nfrom fastapi.staticfiles import StaticFiles\nfrom core.ai import AnimalAI\nfrom core.database import Database, DATA_DIR, PHOTOS_DIR\nfrom core.matcher import AnimalMatcher\nfrom core.seed import seed_if_empty\nfrom PIL import Image as PILImage\n\n\"\"\"\napp.py — PawMap\nBuild Small Hackathon · Backyard AI Track · Junho 2026\nCustom frontend via gradio.Server\n\"\"\"\nimport json\nimport logging\nimport os\nimport tempfile\nimport time\nimport uuid\nfrom pathlib import Path\n\nfrom gradio import Server\nfrom gradio.data_classes import FileData\nfrom fastapi.responses import HTMLResponse, JSONResponse\nfrom fastapi import Query\nfrom fastapi.staticfiles import StaticFiles\n\nfrom core.ai import AnimalAI\nfrom core.database import Database, DATA_DIR, PHOTOS_DIR\nfrom core.matcher import AnimalMatcher\nfrom core.seed import seed_if_empty\n\nlogging.basicConfig(level=logging.INFO)\ndb = Database()\nai = AnimalAI()\nmatcher = AnimalMatcher()\nseed_if_empty(db) # popula o mapa com dados de demo se o banco estiver vazio\n\n\ndef _photo_url(photo_path: str) -> str:\n \"\"\"Convert DB-relative photo path to a URL served by the /photos/ static mount.\n photo_path is relative to DATA_DIR (e.g. 'photos/animal_42/abc.jpg').\n The static mount serves PHOTOS_DIR at /photos/, so we strip the 'photos/' prefix.\n \"\"\"\n if not photo_path:\n return \"\"\n # Normalise separators\n p = photo_path.replace(\"\\\\\", \"/\")\n if p.startswith(\"photos/\"):\n p = p[len(\"photos/\"):]\n return f\"/photos/{p}\"\n\n# In-memory session store for analyze → confirm two-step flow\n_pending: dict[str, dict] = {}\n\napp = Server()\n\n# Serve photos as static files at /photos/...\nPHOTOS_DIR.mkdir(parents=True, exist_ok=True)\napp.mount(\"/photos\", StaticFiles( ..."}, {"id": "build-small-hackathon/GRM-2.6-Opus", "slug": "GRM-2.6-Opus", "title": "GRM-2.6-Opus", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "Text-only ZeroGPU Space for `GRM-2.6-Opus`. Notes: - Built for ZeroGPU with `@spaces.GPU` - Uses 4-bit NF4 quantization to reduce memory pressure - Keeps the UI text-only because the Qwen model card explicitly recommends text-only deployment to save memory and free more KV cache - Exposes Qwen3.6 thinking controls through `enable_thinking` and `preserve_thinking` - Uses shorter default generation lengths than the model card recommendations to behave better in shared ZeroGPU queues", "app": "from threading import Thread\nfrom transformers import (\n\nimport os\nimport re\nimport html\nfrom threading import Thread\n\nimport gradio as gr\nimport spaces\nimport torch\nfrom transformers import (\n AutoModelForCausalLM,\n AutoTokenizer,\n BitsAndBytesConfig,\n TextIteratorStreamer,\n)\n\nMODEL_ID = \"OrionLLM/GRM-2.6-Opus\"\nTITLE = \"GRM-2.6-Opus\"\nSUBTITLE = \"Chat with GRM-2.6-Opus on ZeroGPU\"\nDESCRIPTION = (\n \"Chat with GRM-2.6-Opus in a ZeroGPU Space, optimized with text-only chat, \"\n \"NF4 4-bit loading, bounded context, streaming output, and thinking parsing.\"\n)\n\nPLACEHOLDER = (\n \"Ask GRM-2.6-Opus for code, debugging, planning, research, long-form reasoning, \"\n \"terminal-agent tasks, or complex multi-step workflows.\"\n)\n\nMAX_INPUT_TOKENS = 16384\nINTERNAL_MAX_NEW_TOKENS = 4096\nHF_TOKEN = os.environ.get(\"HF_TOKEN\")\n\nos.environ.setdefault(\"PYTORCH_CUDA_ALLOC_CONF\", \"expandable_segments:True\")\ntorch.backends.cuda.matmul.allow_tf32 = True\n\nBNB_CONFIG = BitsAndBytesConfig(\n load_in_4bit=True,\n bnb_4bit_quant_type=\"nf4\",\n bnb_4bit_use_double_quant=True,\n bnb_4bit_compute_dtype=torch.bfloat16,\n)\n\ntokenizer = AutoTokenizer.from_pretrained(\n MODEL_ID,\n trust_remote_code=True,\n token=HF_TOKEN,\n)\n\nif tokenizer.pad_token is None:\n tokenizer.pad_token = tokenizer.eos_token\n\nmodel = AutoModelForCausalLM.from_pretrained(\n MODEL_ID,\n trust_remote_code=True,\n token=HF_TOKEN,\n device_map={\"\": 0},\n dtype=torch.bfloat16,\n quantization_config=BNB_CONFIG,\n attn_implementation=\"sdpa\",\n low_cpu_mem_usage=True,\n)\n\nmodel.eval()\n\n\ndef model_input_device():\n return next(model.parameters()).device\n\n\ndef strip_thinking(text: str) -> str:\n if not text:\n return \"\"\n\n text = re.sub(\n r\"(?is)]*>\\s*.*?
.*? \",\n \"\",\n text,\n )\n\n text = re.sub(r\"(?is).*? ..."}, {"id": "build-small-hackathon/CodeFlow", "slug": "CodeFlow", "title": "CodeFlow", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "app_only", "readme": "Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference", "app": "from huggingface_hub import hf_hub_download\nfrom llama_cpp import Llama\nfrom gradio import Server\nfrom fastapi.responses import HTMLResponse # serve the custom frontend from a route\nfrom typing import Any, cast # to resolve PyLance freaking out over llama-cpp-python in the generate_flowchart function\nfrom textwrap import dedent\n\n\"\"\"\n3. Graph. Capture the resulting mermaid string and visualize it\n\nTo do\n- create the custom gradio look\n- explore making it look better\n- get a better model — Qwen 30b coder\n- use zerogpu\n\n\"\"\"\nfrom huggingface_hub import hf_hub_download\nfrom llama_cpp import Llama\nimport gradio as gr\nfrom gradio import Server\nfrom fastapi.responses import HTMLResponse # serve the custom frontend from a route\nfrom typing import Any, cast # to resolve PyLance freaking out over llama-cpp-python in the generate_flowchart function\nfrom textwrap import dedent\nimport re # remove thinking tag from response \n\n\n\n out = []\n for line in text.split('\\n'):\n line = re.sub(r'(?<=\\w)\\[(.*?)\\]' + END, lambda m: '[\"' + esc(m.group(1)) + '\"]', line)\n line = re.sub(r'(?<=\\w)\\{(.*?)\\}' + END, lambda m: '{\"' + esc(m.group(1)) + '\"}', line)\n out.append(line)\n return '\\n'.join(out)\n\n@app.api(name=\"generate_flowchart\")\ndef generate_flowchart(src_code: str) -> str:\n # check if src_code is empty\n if not src_code.strip(): return \"\"\n\n # Set system prompt\n system_prompt = dedent(\"\"\"\n ## Role/Persona\n You are a senior staff software architect and compiler engineer specializing in visual control-flow mapping. Your philosophy is pure utility: you translate raw execution logic into highly accurate, scannable, structural diagrams without any conversational filler, meta-commentary, or stylistic fluff.\n\n ## Context/Objective\n The user will provide source code files or logic snippets. Your sole objective is to parse the syntax and output a co ..."}, {"id": "build-small-hackathon/borderless", "slug": "borderless", "title": "Borderless", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# Borderless **An agentic immigration research tool — describe your background in plain English, explore where you could go.** Live demo: **[build-small-hackathon/borderless](https://huggingface.co/spaces/build-small-hackathon/borderless)** Built for the [Build Small Hackathon](https://huggingface.co/build-small-hackathon) — small models (≤32B), big adventure. ## What it does Immigration research is fragmented across government sites, forums, and spreadsheets. Borderless puts it in one conversational flow: 1. **Describe yourself** — citizenship, education, work history, languages, budget, and goals in everyday language. 2. **Use guided intake or chat** — start from a structured profile form, a demo persona, or a free-form message. 3. **Get a shortlist** — the agent reasons over your profile and surfaces destination countries that fit. 4. **Explore on a 3D globe** — shortlisted countries appear on an interactive MapLibre globe beside the chat with pathway labels. 5. **Dig into the details** — visa pathways, required documents, realistic timelines, risks, and source links from official pages. No forms to decode. No keyword guessing. Just a research session that meets you where you are. ## How it works Borderless is a **Gradio agent** powered by **[Qwen/Qwen3.6-27B](https://huggingface.co/Qwen/Qwen3.6-27B)** (27B parameters — within the hackathon's 32B cap). The model plans multi-step research and calls tools when it needs ground truth: | Tool | What it fetches | |------|------- ...", "app": "from pathlib import Path\nfrom ui.workspace import create_main_workspace\nfrom ui.globe import globe_head_html\nfrom ui.sidebar import render_sidebar\n\n# app.py\nfrom pathlib import Path\n\nimport gradio as gr\n\nfrom ui.workspace import create_main_workspace\nfrom ui.globe import globe_head_html\nfrom ui.sidebar import render_sidebar\n\nASSETS_DIR = Path(__file__).resolve().parent / \"assets\"\n\n\ndef create_demo() -> gr.Blocks:\n with gr.Blocks(\n fill_height=True,\n title=\"Borderless - Immigration Research Agent\",\n ) as demo:\n history_host = render_sidebar()\n create_main_workspace(history_container=history_host)\n\n # Injected at launch (Gradio 6); also picked up by Hugging Face Spaces auto-launch.\n app_css = (ASSETS_DIR / \"app.css\").read_text(encoding=\"utf-8\")\n demo._deprecated_head = f\"{globe_head_html()}\\n\"\n return demo\n\n\ndemo = create_demo()\n\nif __name__ == \"__main__\":\n demo.launch()"}, {"id": "build-small-hackathon/quran-stt", "slug": "quran-stt", "title": "Quran Stt", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "app_only", "readme": "Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference", "app": "from huggingface_hub import hf_hub_download\n\nimport os\nimport sys\nimport urllib.parse\nimport gradio as gr\nimport nemo.collections.asr as nemo_asr\nimport torchaudio\n\n# ----------------------------------------------------\n# 1. MODEL INITIALIZATION (Runs once at startup on CPU)\n# ----------------------------------------------------\nprint(\"=\"*60)\nprint(\"Initializing FastConformer Quranic ASR Model on CPU...\")\nprint(\"=\"*60)\nsys.stdout.flush()\n\ntry:\n from huggingface_hub import hf_hub_download\n\n print(\"[STARTUP] Downloading model layer file from HuggingFace Hub...\")\n sys.stdout.flush()\n nemo_file = hf_hub_download(\n repo_id=\"mohammed/fastconformer-quran-ar\",\n filename=\"phase3_full/phase3_full_wer0.0014.nemo\"\n )\n print(f\"[STARTUP] Model file located at: {nemo_file}\")\n\n # Load the .nemo file directly into CPU space\n model = nemo_asr.models.ASRModel.restore_from(restore_path=nemo_file)\n print(\"[STARTUP] Success: Model loaded completely into CPU memory!\")\n sys.stdout.flush()\nexcept Exception as e:\n print(f\"[CRITICAL ERROR] Failed to initialize model: {e}\")\n import traceback\n traceback.print_exc()\n sys.stdout.flush()\n model = None\n\n# ----------------------------------------------------\n# 2. SAFE TEXT EXTRACTION UTILITY\n# ----------------------------------------------------\ndef deep_extract_text(obj):\n \"\"\"\n Recursively drills down into any nested tuple, list, or custom NeMo \n Hypothesis object to guarantee the extraction of a pure Python string.\n \"\"\"\n if isinstance(obj, str):\n return obj\n \n if isinstance(obj, (list, tuple)):\n for item in obj:\n extracted = deep_extract_text(item)\n if extracted:\n return extracted\n \n # If it's a NeMo Hypothesis object, check its internal fields dynamically\n if obj is not None:\n # Try findi ..."}, {"id": "build-small-hackathon/dream-museum", "slug": "dream-museum", "title": "Dream Museum", "sdk": "gradio", "models": [], "tags": ["gradio", "region:us"], "app_file": "app.py", "structural_profile": "both", "readme": "# ◈ Dream Museum *Draw a dream · Describe it · Watch it materialize · Hang it in the museum* Built for the **HuggingFace Build Small Hackathon 2026** — Thousand Token Wood track. ## How it works 1. Open the Gradio interface and sketch your dream on the canvas 2. Describe it in words 3. SDXL + ControlNet-scribble materializes it into an image 4. Save it to the public museum or keep it private 5. Visit the 3D museum to see all exhibited dreams ## Models used | Model | Params | Role | |---|---|---| | [stabilityai/stable-diffusion-xl-base-1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0) | ~3.5B | Image generation | | [xinsir/controlnet-scribble-sdxl-1.0](https://huggingface.co/xinsir/controlnet-scribble-sdxl-1.0) | ~1.4B | Sketch guidance | **Total: ~5B parameters** — well within the 32B limit. ## Environment variables (Space secrets) | Variable | Description | |---|---| | `HF_TOKEN` | HuggingFace token with write access to the gallery dataset | | `GALLERY_DATASET` | Dataset repo ID, e.g. `your-username/dream-museum-gallery` |", "app": "from pathlib import Path\nfrom dotenv import load_dotenv\nfrom fastapi import Request\nfrom fastapi.responses import FileResponse, JSONResponse\nfrom fastapi.staticfiles import StaticFiles\nfrom PIL import Image\n\nimport io\nimport base64\nfrom pathlib import Path\n\nfrom dotenv import load_dotenv\nload_dotenv()\n\nfrom fastapi import Request\nfrom fastapi.responses import FileResponse, JSONResponse\nfrom fastapi.staticfiles import StaticFiles\nfrom PIL import Image\nimport gradio as gr\n\nimport gallery as gallery_module\nimport inference as inference_module\n\nSTATIC = Path(__file__).parent / \"static\"\n\n\n# ── Gradio generate function ──────────────────────────────────────────────────\n\ndef _gradio_generate(sketch_data, description: str, strength: float):\n if sketch_data is None or not description.strip():\n return None\n sketch_img = (\n sketch_data.get(\"composite\")\n if isinstance(sketch_data, dict)\n else sketch_data\n )\n if sketch_img is None:\n return None\n buf = io.BytesIO()\n sketch_img.convert(\"RGB\").save(buf, format=\"PNG\")\n sketch_b64 = \"data:image/png;base64,\" + base64.b64encode(buf.getvalue()).decode()\n image_b64 = inference_module.generate(sketch_b64, description.strip(), float(strength))\n img_bytes = base64.b64decode(image_b64)\n return Image.open(io.BytesIO(img_bytes)).convert(\"RGB\")\n\n\n# ── Gradio Blocks UI ──────────────────────────────────────────────────────────\n# Gradio is required for ZeroGPU (@spaces.GPU) to work on HF Spaces.\n# We redirect visitors to /museum immediately via meta-refresh + JS.\n\nwith gr.Blocks(title=\"Dream Museum\") as demo:\n\n gr.HTML(\"\"\"\n \n \n