Backyard AI
Best Agent
Off-Brand
Sharing is Caring

[System] You classify hackathon projects against fixed quest dimensions. Return exactly one strict JSON object and nothing else. The first character must be { and the last character must be }. Each match needs quest, confidence, evidence, and source (readme or app_file). Never emit markdown, prose, a top-level array, extra keys, or an unknown or rephrased quest name.

[User]
Classify this hackathon project against the quest dimensions below.
Read the two evidence segments (README and APP_FILE) and judge each quest only from them.

Quests (copy the id on the left verbatim):
- Off the Grid: Runs the model on-device with no remote inference call: weights load locally and inference happens in-process, not over a hosted API. Signals: AWARD on a local in-process load: from_pretrained / pipeline / llama_cpp / diffusers / vLLM / ONNX, GGUF weights, @spaces.GPU. DISQUALIFY (do NOT award) on ANY remote inference call, even via huggingface_hub: InferenceClient, HF Inference API/Endpoints, gradio_client to a remote Space, replicate/together/openrouter/fal/groq, a *.modal.run or other HTTP inference endpoint, or openai/anthropic/gemini/cohere clients. A remote call disqualifies regardless of which model it names.
- Well-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.
- Off-Brand: 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.
- Llama Champion: Runs a model through the llama.cpp runtime. Signals: llama-cpp-python, from llama_cpp import Llama, GGUF file, llama.cpp, Llama( constructor.
- Sharing is Caring: 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.
- Field 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.
- Backyard AI: 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.
- Thousand Token Wood: 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.
- OpenBMB: Uses a model published by OpenBMB (the openbmb org), such as the MiniCPM family. Signals: The model id org prefix must be exactly openbmb/ (openbmb/MiniCPM*, OpenCPM). A model from any other org is NOT OpenBMB: openai/gpt-oss, Qwen/..., meta-llama/..., google/..., nvidia/..., microsoft/..., mistralai/... do NOT count just because a model id is present.
- Nemotron: Uses an NVIDIA Nemotron model (Nemotron LLM, Parakeet, Nemotron-Speech, Canary). Signals: model repo nvidia/...nemotron..., Parakeet, nemotron-speech, Canary ASR.
- Modal: Uses Modal for training, inference, or background compute. Signals: import modal, modal.App, @app.function, Modal endpoint/volume, README cites Modal compute.
- Tiny Titan: Runs on a genuinely small model of about four billion parameters or fewer. Signals: AWARD when the model name says <=4B: 0.5B/1B/1.5B/2B/3B/4B or tiny/small/nano/mini (Qwen2.5-1.5B, MiniCPM5-1B, gemma-2b). Do NOT award for 7B/8B/12B/13B/20B/27B/35B+ models (e.g. gpt-oss-20b, Qwen2.5-7B); a version number like V-4.6 is not a parameter count.
- Best Agent: 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.

Rules:
- Include a quest only when a segment gives clear, specific evidence.
- quest must be one id from the list above, copied exactly. Never invent or rephrase a quest name.
- confidence is a number between 0 and 1.
- evidence is a 3-to-12 word quote or tight paraphrase taken from the segment you cite.
- source is "readme" when the evidence is in the README segment, "app_file" when it is in the APP_FILE segment.
- At most one match per quest. Sort matches by confidence, highest first.
- If no quest has clear evidence, return an empty matches list.
- Output exactly one JSON object: {"matches":[{"quest":"...","confidence":0.0,"evidence":"...","source":"readme"}]}.
- No markdown, no code fences, no commentary, no extra keys.

METADATA: {"title": "Backyard Demo Builder", "sdk": "gradio", "declared_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"]}

[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_FILE] app.py
from __future__ import annotations
from arena.api import app as fastapi_app
from arena.api import service
from arena.gradio_app import RunOutputs, build_app, create_run_gpu as _create_run_gpu

"""Unified ASGI entrypoint for API and Gradio UI."""

from __future__ import annotations

import os

import gradio as gr
import uvicorn

try:
    import spaces
except Exception:
    class _SpacesShim:
        def GPU(self, fn=None, **kwargs):
            del kwargs

            def decorator(inner):
                return inner

            return decorator(fn) if fn else decorator

    spaces = _SpacesShim()

from arena.api import app as fastapi_app
from arena.api import service
from arena.gradio_app import RunOutputs, build_app, create_run_gpu as _create_run_gpu

@spaces.GPU(duration=120)
def create_run_gpu(
    prompt: str,
    criteria_text: str,
    user_tests_text: str,
    provider: str = "openrouter",
    model: str = "",
    api_key: str = "",
    base_url: str = "",
) -> RunOutputs:
    return _create_run_gpu(
        prompt,
        criteria_text,
        user_tests_text,
        provider,
        model,
        api_key,
        base_url,
    )

@spaces.GPU
def zerogpu_ready_marker() -> str:
    return "ready"

demo = build_app(service, create_run_handler=create_run_gpu)

def create_app():
    """Create one FastAPI ASGI app with Gradio mounted at the root."""

    return gr.mount_gradio_app(fastapi_app, demo, path="/")

app = create_app()

def server_config() -> dict[str, int | str]:
    host = os.getenv("GRADIO_SERVER_NAME", os.getenv("HOST", "0.0.0.0"))
    port = int(os.getenv("GRADIO_SERVER_PORT") or os.getenv("PORT") or "7860")
    return {"host": host, "port": port}

def gradio_launch_config() -> dict[str, bool | int | str]:
    config = server_config()
    port = int(os.getenv("GRADIO_SERVER_PORT") or os.getenv("PORT") or "7860")
    return {"server_nam ...

[Assistant] {"matches":[{"quest":"Backyard AI","confidence":0.93,"evidence":"my mom, a real-estate agent; cheap way to test follow-up reminder workflow","source":"readme"},{"quest":"Sharing is Caring","confidence":0.85,"evidence":"downloadable demo package: files you can inspect, unzip, run, and test","source":"readme"},{"quest":"Off-Brand","confidence":0.78,"evidence":"Fully custom CSS dark theme — Archivo + IBM Plex Mono, acid green CTAs","source":"readme"},{"quest":"Best Agent","confidence":0.5,"evidence":"agent-swarm-workbench generates app, spec, field notes, and checks","source":"readme"}]}


[System] You classify hackathon projects against fixed quest dimensions. Return exactly one strict JSON object and nothing else. The first character must be { and the last character must be }. Each match needs quest, confidence, evidence, and source (readme or app_file). Never emit markdown, prose, a top-level array, extra keys, or an unknown or rephrased quest name.

[User]
Classify this hackathon project against the quest dimensions below.
Read the two evidence segments (README and APP_FILE) and judge each quest only from them.

Quests (copy the id on the left verbatim):
- Off the Grid: Runs the model on-device with no remote inference call: weights load locally and inference happens in-process, not over a hosted API. Signals: AWARD on a local in-process load: from_pretrained / pipeline / llama_cpp / diffusers / vLLM / ONNX, GGUF weights, @spaces.GPU. DISQUALIFY (do NOT award) on ANY remote inference call, even via huggingface_hub: InferenceClient, HF Inference API/Endpoints, gradio_client to a remote Space, replicate/together/openrouter/fal/groq, a *.modal.run or other HTTP inference endpoint, or openai/anthropic/gemini/cohere clients. A remote call disqualifies regardless of which model it names.
- Well-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.
- Off-Brand: 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.
- Llama Champion: Runs a model through the llama.cpp runtime. Signals: llama-cpp-python, from llama_cpp import Llama, GGUF file, llama.cpp, Llama( constructor.
- Sharing is Caring: 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.
- Field 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.
- Backyard AI: 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.
- Thousand Token Wood: 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.
- OpenBMB: Uses a model published by OpenBMB (the openbmb org), such as the MiniCPM family. Signals: The model id org prefix must be exactly openbmb/ (openbmb/MiniCPM*, OpenCPM). A model from any other org is NOT OpenBMB: openai/gpt-oss, Qwen/..., meta-llama/..., google/..., nvidia/..., microsoft/..., mistralai/... do NOT count just because a model id is present.
- Nemotron: Uses an NVIDIA Nemotron model (Nemotron LLM, Parakeet, Nemotron-Speech, Canary). Signals: model repo nvidia/...nemotron..., Parakeet, nemotron-speech, Canary ASR.
- Modal: Uses Modal for training, inference, or background compute. Signals: import modal, modal.App, @app.function, Modal endpoint/volume, README cites Modal compute.
- Tiny Titan: Runs on a genuinely small model of about four billion parameters or fewer. Signals: AWARD when the model name says <=4B: 0.5B/1B/1.5B/2B/3B/4B or tiny/small/nano/mini (Qwen2.5-1.5B, MiniCPM5-1B, gemma-2b). Do NOT award for 7B/8B/12B/13B/20B/27B/35B+ models (e.g. gpt-oss-20b, Qwen2.5-7B); a version number like V-4.6 is not a parameter count.
- Best Agent: 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.

Rules:
- Include a quest only when a segment gives clear, specific evidence.
- quest must be one id from the list above, copied exactly. Never invent or rephrase a quest name.
- confidence is a number between 0 and 1.
- evidence is a 3-to-12 word quote or tight paraphrase taken from the segment you cite.
- source is "readme" when the evidence is in the README segment, "app_file" when it is in the APP_FILE segment.
- At most one match per quest. Sort matches by confidence, highest first.
- If no quest has clear evidence, return an empty matches list.
- Output exactly one JSON object: {"matches":[{"quest":"...","confidence":0.0,"evidence":"...","source":"readme"}]}.
- No markdown, no code fences, no commentary, no extra keys.

METADATA: {"title": "Code Shrink Token Decimator", "sdk": "gradio", "declared_models": [], "tags": ["gradio", "region:us"]}

[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_FILE] app.py
import sys
import types
import ast
import re
import json

# 🚨 DYNAMIC FIX: Python 3.13 Compatibility Core Patches
if 'audioop' not in sys.modules:
    dummy_audioop = types.ModuleType('audioop')
    dummy_audioop.error = Exception
    sys.modules['audioop'] = dummy_audioop

if 'pyaudioop' not in sys.modules:
    dummy_pyaudioop = types.ModuleType('pyaudioop')
    dummy_pyaudioop.error = Exception
    sys.modules['pyaudioop'] = dummy_pyaudioop

try:
    import huggingface_hub
except ImportError:
    huggingface_hub = types.ModuleType('huggingface_hub')
    sys.modules['huggingface_hub'] = huggingface_hub

if not hasattr(huggingface_hub, 'HfFolder'):
    class DummyHfFolder:
        @staticmethod
        def get_token(): return None
        @staticmethod
        def save_token(token): pass
        @staticmethod
        def delete_token(): pass
    huggingface_hub.HfFolder = DummyHfFolder

import gradio as gr

def estimate_tokens(text):
    """Ultra-fast local token estimator (Roughly 1 token = 4 chars for code/text setup)"""
    if not text:
        return 0
    return max(1, len(text) // 4 + text.count(' ') // 2)

def shrink_python_code(source_code):
    """Parses and strips syntax trees to remove bloat tokens natively"""
    try:
        tree = ast.parse(source_code)
        for node in ast.walk(tree):
            if isinstance(node, (ast.FunctionDef, ast.ClassDef, ast.Module)):
                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):
                    node.body.pop(0)

        clean_code = ast.unparse(tree)
        clean_code = re.sub(r'\n\s*\n', '\n', clean_code)
        return clean_code.strip()
    except Exception:
        code = re.sub(r'#.*', '', source_code)
        code = re.sub(r'\"\"\"[\s\S]*?\"\"\"', '', code)
        code = re.s ...

[Assistant] {"matches":[{"quest":"Field Notes","confidence":0.5,"evidence":"README writes up the Bottleneck (LLM Context Inflation) and the Engine (AST framework)","source":"readme"}]}


[System] You classify hackathon projects against fixed quest dimensions. Return exactly one strict JSON object and nothing else. The first character must be { and the last character must be }. Each match needs quest, confidence, evidence, and source (readme or app_file). Never emit markdown, prose, a top-level array, extra keys, or an unknown or rephrased quest name.

[User]
Classify this hackathon project against the quest dimensions below.
Read the two evidence segments (README and APP_FILE) and judge each quest only from them.

Quests (copy the id on the left verbatim):
- Off the Grid: Runs the model on-device with no remote inference call: weights load locally and inference happens in-process, not over a hosted API. Signals: AWARD on a local in-process load: from_pretrained / pipeline / llama_cpp / diffusers / vLLM / ONNX, GGUF weights, @spaces.GPU. DISQUALIFY (do NOT award) on ANY remote inference call, even via huggingface_hub: InferenceClient, HF Inference API/Endpoints, gradio_client to a remote Space, replicate/together/openrouter/fal/groq, a *.modal.run or other HTTP inference endpoint, or openai/anthropic/gemini/cohere clients. A remote call disqualifies regardless of which model it names.
- Well-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.
- Off-Brand: 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.
- Llama Champion: Runs a model through the llama.cpp runtime. Signals: llama-cpp-python, from llama_cpp import Llama, GGUF file, llama.cpp, Llama( constructor.
- Sharing is Caring: 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.
- Field 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.
- Backyard AI: 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.
- Thousand Token Wood: 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.
- OpenBMB: Uses a model published by OpenBMB (the openbmb org), such as the MiniCPM family. Signals: The model id org prefix must be exactly openbmb/ (openbmb/MiniCPM*, OpenCPM). A model from any other org is NOT OpenBMB: openai/gpt-oss, Qwen/..., meta-llama/..., google/..., nvidia/..., microsoft/..., mistralai/... do NOT count just because a model id is present.
- Nemotron: Uses an NVIDIA Nemotron model (Nemotron LLM, Parakeet, Nemotron-Speech, Canary). Signals: model repo nvidia/...nemotron..., Parakeet, nemotron-speech, Canary ASR.
- Modal: Uses Modal for training, inference, or background compute. Signals: import modal, modal.App, @app.function, Modal endpoint/volume, README cites Modal compute.
- Tiny Titan: Runs on a genuinely small model of about four billion parameters or fewer. Signals: AWARD when the model name says <=4B: 0.5B/1B/1.5B/2B/3B/4B or tiny/small/nano/mini (Qwen2.5-1.5B, MiniCPM5-1B, gemma-2b). Do NOT award for 7B/8B/12B/13B/20B/27B/35B+ models (e.g. gpt-oss-20b, Qwen2.5-7B); a version number like V-4.6 is not a parameter count.
- Best Agent: 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.

Rules:
- Include a quest only when a segment gives clear, specific evidence.
- quest must be one id from the list above, copied exactly. Never invent or rephrase a quest name.
- confidence is a number between 0 and 1.
- evidence is a 3-to-12 word quote or tight paraphrase taken from the segment you cite.
- source is "readme" when the evidence is in the README segment, "app_file" when it is in the APP_FILE segment.
- At most one match per quest. Sort matches by confidence, highest first.
- If no quest has clear evidence, return an empty matches list.
- Output exactly one JSON object: {"matches":[{"quest":"...","confidence":0.0,"evidence":"...","source":"readme"}]}.
- No markdown, no code fences, no commentary, no extra keys.

METADATA: {"title": "briefing-32", "sdk": "gradio", "declared_models": [], "tags": ["gradio", "region:us"]}

[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_FILE] app.py
from __future__ import annotations
from typing import Any
from config import (
from digest import make_digest
from fetch import fetch_all
from rank import RankerConfig, rank_pipeline

"""briefing-32 — Gradio app entry for Hugging Face Spaces.

Build Small Hackathon submission (Backyard AI track):
A small-model down-port of ~/ai-news-agent. The production version uses
Groq Llama-3.3-70B; this version fits the same workflow under 32B params
using Qwen3-32B via Hugging Face Inference Providers.

Same pipeline as the every-2-hours cron the maker has running on a laptop:
fetch RSS / HN / arXiv / GitHub -> two-pass relevance filter + ranker ->
readable digest. Gradio is the delivery surface here instead of WhatsApp.
"""
from __future__ import annotations

import os
import time
from typing import Any

import gradio as gr
import pandas as pd

from config import (
    DEFAULT_BASE_URL,
    DEFAULT_MODEL,
    MIN_NEW_ITEMS,
    PER_SOURCE_CAP,
)
from digest import make_digest
from fetch import fetch_all
from rank import RankerConfig, rank_pipeline

# ---------------------------------------------------------------------------
# Core pipeline (callable from Gradio + scripts/cli.py)
# ---------------------------------------------------------------------------

def run_briefing(
    window_hours: int,
    enabled_sources: list[str],
    model: str,
    hf_token: str,
) -> dict[str, Any]:
    """Fetch -> filter -> rank -> digest. Returns everything for the UI."""
    since_ts = time.time() - window_hours * 3600
    enabled = set(enabled_sources) if enabled_sources else {"rss", "hn", "arxiv", "github"}

    t0 = time.perf_counter()
    raw = fetch_all(since_ts, enabled=enabled)
    fetch_latency = time.perf_counter() - t0

    cfg = RankerConfig(
        base_url=DEFAULT_BASE_URL,
        model=model or DEFAULT_MODEL,
        api_key=hf_token or "",
    )
    result = rank_pipeline ...

[Assistant] {"matches":[{"quest":"Backyard AI","confidence":0.95,"evidence":"personal cron that already runs every two hours on the maker's laptop","source":"readme"},{"quest":"Field Notes","confidence":0.7,"evidence":"honest story... split the single 70B scoring pass into two cheaper passes","source":"readme"}]}


[System] You classify hackathon projects against fixed quest dimensions. Return exactly one strict JSON object and nothing else. The first character must be { and the last character must be }. Each match needs quest, confidence, evidence, and source (readme or app_file). Never emit markdown, prose, a top-level array, extra keys, or an unknown or rephrased quest name.

[User]
Classify this hackathon project against the quest dimensions below.
Read the two evidence segments (README and APP_FILE) and judge each quest only from them.

Quests (copy the id on the left verbatim):
- Off the Grid: Runs the model on-device with no remote inference call: weights load locally and inference happens in-process, not over a hosted API. Signals: AWARD on a local in-process load: from_pretrained / pipeline / llama_cpp / diffusers / vLLM / ONNX, GGUF weights, @spaces.GPU. DISQUALIFY (do NOT award) on ANY remote inference call, even via huggingface_hub: InferenceClient, HF Inference API/Endpoints, gradio_client to a remote Space, replicate/together/openrouter/fal/groq, a *.modal.run or other HTTP inference endpoint, or openai/anthropic/gemini/cohere clients. A remote call disqualifies regardless of which model it names.
- Well-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.
- Off-Brand: 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.
- Llama Champion: Runs a model through the llama.cpp runtime. Signals: llama-cpp-python, from llama_cpp import Llama, GGUF file, llama.cpp, Llama( constructor.
- Sharing is Caring: 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.
- Field 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.
- Backyard AI: 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.
- Thousand Token Wood: 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.
- OpenBMB: Uses a model published by OpenBMB (the openbmb org), such as the MiniCPM family. Signals: The model id org prefix must be exactly openbmb/ (openbmb/MiniCPM*, OpenCPM). A model from any other org is NOT OpenBMB: openai/gpt-oss, Qwen/..., meta-llama/..., google/..., nvidia/..., microsoft/..., mistralai/... do NOT count just because a model id is present.
- Nemotron: Uses an NVIDIA Nemotron model (Nemotron LLM, Parakeet, Nemotron-Speech, Canary). Signals: model repo nvidia/...nemotron..., Parakeet, nemotron-speech, Canary ASR.
- Modal: Uses Modal for training, inference, or background compute. Signals: import modal, modal.App, @app.function, Modal endpoint/volume, README cites Modal compute.
- Tiny Titan: Runs on a genuinely small model of about four billion parameters or fewer. Signals: AWARD when the model name says <=4B: 0.5B/1B/1.5B/2B/3B/4B or tiny/small/nano/mini (Qwen2.5-1.5B, MiniCPM5-1B, gemma-2b). Do NOT award for 7B/8B/12B/13B/20B/27B/35B+ models (e.g. gpt-oss-20b, Qwen2.5-7B); a version number like V-4.6 is not a parameter count.
- Best Agent: 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.

Rules:
- Include a quest only when a segment gives clear, specific evidence.
- quest must be one id from the list above, copied exactly. Never invent or rephrase a quest name.
- confidence is a number between 0 and 1.
- evidence is a 3-to-12 word quote or tight paraphrase taken from the segment you cite.
- source is "readme" when the evidence is in the README segment, "app_file" when it is in the APP_FILE segment.
- At most one match per quest. Sort matches by confidence, highest first.
- If no quest has clear evidence, return an empty matches list.
- Output exactly one JSON object: {"matches":[{"quest":"...","confidence":0.0,"evidence":"...","source":"readme"}]}.
- No markdown, no code fences, no commentary, no extra keys.

METADATA: {"title": "PawMap", "sdk": "docker", "declared_models": [], "tags": ["docker", "region:us"]}

[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_FILE] app.py
from pathlib import Path
from gradio import Server
from gradio.data_classes import FileData
from fastapi.responses import HTMLResponse, JSONResponse
from fastapi import Query
from fastapi.staticfiles import StaticFiles
from core.ai import AnimalAI
from core.database import Database, DATA_DIR, PHOTOS_DIR
from core.matcher import AnimalMatcher
from core.seed import seed_if_empty
from PIL import Image as PILImage

"""
app.py — PawMap
Build Small Hackathon · Backyard AI Track · Junho 2026
Custom frontend via gradio.Server
"""
import json
import logging
import os
import tempfile
import time
import uuid
from pathlib import Path

from gradio import Server
from gradio.data_classes import FileData
from fastapi.responses import HTMLResponse, JSONResponse
from fastapi import Query
from fastapi.staticfiles import StaticFiles

from core.ai import AnimalAI
from core.database import Database, DATA_DIR, PHOTOS_DIR
from core.matcher import AnimalMatcher
from core.seed import seed_if_empty

logging.basicConfig(level=logging.INFO)
db      = Database()
ai      = AnimalAI()
matcher = AnimalMatcher()
seed_if_empty(db)   # popula o mapa com dados de demo se o banco estiver vazio

def _photo_url(photo_path: str) -> str:
    """Convert DB-relative photo path to a URL served by the /photos/ static mount.
    photo_path is relative to DATA_DIR (e.g. 'photos/animal_42/abc.jpg').
    The static mount serves PHOTOS_DIR at /photos/, so we strip the 'photos/' prefix.
    """
    if not photo_path:
        return ""
    # Normalise separators
    p = photo_path.replace("\\", "/")
    if p.startswith("photos/"):
        p = p[len("photos/"):]
    return f"/photos/{p}"

# In-memory session store for analyze → confirm two-step flow
_pending: dict[str, dict] = {}

app = Server()

# Serve photos as static files at /photos/...
PHOTOS_DIR.mkdir(parents=True, exist_ok=True)
app.mount("/photos", StaticFiles( ...

[Assistant] {"matches":[{"quest":"Off-Brand","confidence":0.92,"evidence":"Custom frontend via gradio.Server","source":"app_file"},{"quest":"Nemotron","confidence":0.85,"evidence":"Nemotron Omni via NVIDIA NIM (tem precedência)","source":"readme"}]}


[System] You classify hackathon projects against fixed quest dimensions. Return exactly one strict JSON object and nothing else. The first character must be { and the last character must be }. Each match needs quest, confidence, evidence, and source (readme or app_file). Never emit markdown, prose, a top-level array, extra keys, or an unknown or rephrased quest name.

[User]
Classify this hackathon project against the quest dimensions below.
Read the two evidence segments (README and APP_FILE) and judge each quest only from them.

Quests (copy the id on the left verbatim):
- Off the Grid: Runs the model on-device with no remote inference call: weights load locally and inference happens in-process, not over a hosted API. Signals: AWARD on a local in-process load: from_pretrained / pipeline / llama_cpp / diffusers / vLLM / ONNX, GGUF weights, @spaces.GPU. DISQUALIFY (do NOT award) on ANY remote inference call, even via huggingface_hub: InferenceClient, HF Inference API/Endpoints, gradio_client to a remote Space, replicate/together/openrouter/fal/groq, a *.modal.run or other HTTP inference endpoint, or openai/anthropic/gemini/cohere clients. A remote call disqualifies regardless of which model it names.
- Well-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.
- Off-Brand: 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.
- Llama Champion: Runs a model through the llama.cpp runtime. Signals: llama-cpp-python, from llama_cpp import Llama, GGUF file, llama.cpp, Llama( constructor.
- Sharing is Caring: 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.
- Field 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.
- Backyard AI: 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.
- Thousand Token Wood: 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.
- OpenBMB: Uses a model published by OpenBMB (the openbmb org), such as the MiniCPM family. Signals: The model id org prefix must be exactly openbmb/ (openbmb/MiniCPM*, OpenCPM). A model from any other org is NOT OpenBMB: openai/gpt-oss, Qwen/..., meta-llama/..., google/..., nvidia/..., microsoft/..., mistralai/... do NOT count just because a model id is present.
- Nemotron: Uses an NVIDIA Nemotron model (Nemotron LLM, Parakeet, Nemotron-Speech, Canary). Signals: model repo nvidia/...nemotron..., Parakeet, nemotron-speech, Canary ASR.
- Modal: Uses Modal for training, inference, or background compute. Signals: import modal, modal.App, @app.function, Modal endpoint/volume, README cites Modal compute.
- Tiny Titan: Runs on a genuinely small model of about four billion parameters or fewer. Signals: AWARD when the model name says <=4B: 0.5B/1B/1.5B/2B/3B/4B or tiny/small/nano/mini (Qwen2.5-1.5B, MiniCPM5-1B, gemma-2b). Do NOT award for 7B/8B/12B/13B/20B/27B/35B+ models (e.g. gpt-oss-20b, Qwen2.5-7B); a version number like V-4.6 is not a parameter count.
- Best Agent: 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.

Rules:
- Include a quest only when a segment gives clear, specific evidence.
- quest must be one id from the list above, copied exactly. Never invent or rephrase a quest name.
- confidence is a number between 0 and 1.
- evidence is a 3-to-12 word quote or tight paraphrase taken from the segment you cite.
- source is "readme" when the evidence is in the README segment, "app_file" when it is in the APP_FILE segment.
- At most one match per quest. Sort matches by confidence, highest first.
- If no quest has clear evidence, return an empty matches list.
- Output exactly one JSON object: {"matches":[{"quest":"...","confidence":0.0,"evidence":"...","source":"readme"}]}.
- No markdown, no code fences, no commentary, no extra keys.

METADATA: {"title": "GRM-2.6-Opus", "sdk": "gradio", "declared_models": [], "tags": ["gradio", "region:us"]}

[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_FILE] app.py
from threading import Thread
from transformers import (

import os
import re
import html
from threading import Thread

import gradio as gr
import spaces
import torch
from transformers import (
    AutoModelForCausalLM,
    AutoTokenizer,
    BitsAndBytesConfig,
    TextIteratorStreamer,
)

MODEL_ID = "OrionLLM/GRM-2.6-Opus"
TITLE = "GRM-2.6-Opus"
SUBTITLE = "Chat with GRM-2.6-Opus on ZeroGPU"
DESCRIPTION = (
    "Chat with GRM-2.6-Opus in a ZeroGPU Space, optimized with text-only chat, "
    "NF4 4-bit loading, bounded context, streaming output, and thinking parsing."
)

PLACEHOLDER = (
    "Ask GRM-2.6-Opus for code, debugging, planning, research, long-form reasoning, "
    "terminal-agent tasks, or complex multi-step workflows."
)

MAX_INPUT_TOKENS = 16384
INTERNAL_MAX_NEW_TOKENS = 4096
HF_TOKEN = os.environ.get("HF_TOKEN")

os.environ.setdefault("PYTORCH_CUDA_ALLOC_CONF", "expandable_segments:True")
torch.backends.cuda.matmul.allow_tf32 = True

BNB_CONFIG = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_use_double_quant=True,
    bnb_4bit_compute_dtype=torch.bfloat16,
)

tokenizer = AutoTokenizer.from_pretrained(
    MODEL_ID,
    trust_remote_code=True,
    token=HF_TOKEN,
)

if tokenizer.pad_token is None:
    tokenizer.pad_token = tokenizer.eos_token

model = AutoModelForCausalLM.from_pretrained(
    MODEL_ID,
    trust_remote_code=True,
    token=HF_TOKEN,
    device_map={"": 0},
    dtype=torch.bfloat16,
    quantization_config=BNB_CONFIG,
    attn_implementation="sdpa",
    low_cpu_mem_usage=True,
)

model.eval()

def model_input_device():
    return next(model.parameters()).device

def strip_thinking(text: str) -> str:
    if not text:
        return ""

    text = re.sub(
        r"(?is)]*>\s*.*?.*?",
        "",
        text,
    )

    text = re.sub(r"(?is)<think>.*?</think> ...

[Assistant] {"matches":[{"quest":"Off the Grid","confidence":0.85,"evidence":"loads OrionLLM/GRM-2.6-Opus via AutoModelForCausalLM, no cloud API imports","source":"app_file"}]}


[System] You classify hackathon projects against fixed quest dimensions. Return exactly one strict JSON object and nothing else. The first character must be { and the last character must be }. Each match needs quest, confidence, evidence, and source (readme or app_file). Never emit markdown, prose, a top-level array, extra keys, or an unknown or rephrased quest name.

[User]
Classify this hackathon project against the quest dimensions below.
Read the two evidence segments (README and APP_FILE) and judge each quest only from them.

Quests (copy the id on the left verbatim):
- Off the Grid: Runs the model on-device with no remote inference call: weights load locally and inference happens in-process, not over a hosted API. Signals: AWARD on a local in-process load: from_pretrained / pipeline / llama_cpp / diffusers / vLLM / ONNX, GGUF weights, @spaces.GPU. DISQUALIFY (do NOT award) on ANY remote inference call, even via huggingface_hub: InferenceClient, HF Inference API/Endpoints, gradio_client to a remote Space, replicate/together/openrouter/fal/groq, a *.modal.run or other HTTP inference endpoint, or openai/anthropic/gemini/cohere clients. A remote call disqualifies regardless of which model it names.
- Well-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.
- Off-Brand: 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.
- Llama Champion: Runs a model through the llama.cpp runtime. Signals: llama-cpp-python, from llama_cpp import Llama, GGUF file, llama.cpp, Llama( constructor.
- Sharing is Caring: 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.
- Field 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.
- Backyard AI: 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.
- Thousand Token Wood: 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.
- OpenBMB: Uses a model published by OpenBMB (the openbmb org), such as the MiniCPM family. Signals: The model id org prefix must be exactly openbmb/ (openbmb/MiniCPM*, OpenCPM). A model from any other org is NOT OpenBMB: openai/gpt-oss, Qwen/..., meta-llama/..., google/..., nvidia/..., microsoft/..., mistralai/... do NOT count just because a model id is present.
- Nemotron: Uses an NVIDIA Nemotron model (Nemotron LLM, Parakeet, Nemotron-Speech, Canary). Signals: model repo nvidia/...nemotron..., Parakeet, nemotron-speech, Canary ASR.
- Modal: Uses Modal for training, inference, or background compute. Signals: import modal, modal.App, @app.function, Modal endpoint/volume, README cites Modal compute.
- Tiny Titan: Runs on a genuinely small model of about four billion parameters or fewer. Signals: AWARD when the model name says <=4B: 0.5B/1B/1.5B/2B/3B/4B or tiny/small/nano/mini (Qwen2.5-1.5B, MiniCPM5-1B, gemma-2b). Do NOT award for 7B/8B/12B/13B/20B/27B/35B+ models (e.g. gpt-oss-20b, Qwen2.5-7B); a version number like V-4.6 is not a parameter count.
- Best Agent: 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.

Rules:
- Include a quest only when a segment gives clear, specific evidence.
- quest must be one id from the list above, copied exactly. Never invent or rephrase a quest name.
- confidence is a number between 0 and 1.
- evidence is a 3-to-12 word quote or tight paraphrase taken from the segment you cite.
- source is "readme" when the evidence is in the README segment, "app_file" when it is in the APP_FILE segment.
- At most one match per quest. Sort matches by confidence, highest first.
- If no quest has clear evidence, return an empty matches list.
- Output exactly one JSON object: {"matches":[{"quest":"...","confidence":0.0,"evidence":"...","source":"readme"}]}.
- No markdown, no code fences, no commentary, no extra keys.

METADATA: {"title": "CodeFlow", "sdk": "gradio", "declared_models": [], "tags": ["gradio", "region:us"]}

[README]
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

[APP_FILE] app.py
from huggingface_hub import hf_hub_download
from llama_cpp import Llama
from gradio import Server
from fastapi.responses import HTMLResponse # serve the custom frontend from a route
from typing import Any, cast # to resolve PyLance freaking out over llama-cpp-python in the generate_flowchart function
from textwrap import dedent

"""
3. Graph. Capture the resulting mermaid string and visualize it

To do
- create the custom gradio look
- explore making it look better
- get a better model — Qwen 30b coder
- use zerogpu

"""
from huggingface_hub import hf_hub_download
from llama_cpp import Llama
import gradio as gr
from gradio import Server
from fastapi.responses import HTMLResponse # serve the custom frontend from a route
from typing import Any, cast # to resolve PyLance freaking out over llama-cpp-python in the generate_flowchart function
from textwrap import dedent
import re # remove thinking tag from response

    out = []
    for line in text.split('\n'):
        line = re.sub(r'(?<=\w)\[(.*?)\]' + END, lambda m: '["' + esc(m.group(1)) + '"]', line)
        line = re.sub(r'(?<=\w)\{(.*?)\}' + END, lambda m: '{"' + esc(m.group(1)) + '"}', line)
        out.append(line)
    return '\n'.join(out)

@app.api(name="generate_flowchart")
def generate_flowchart(src_code: str) -> str:
    # check if src_code is empty
    if not src_code.strip(): return ""

    # Set system prompt
    system_prompt = dedent("""
    ## Role/Persona
    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.

    ## Context/Objective
    The user will provide source code files or logic snippets. Your sole objective is to parse the syntax and output a co ...

[Assistant] {"matches":[{"quest":"Llama Champion","confidence":0.97,"evidence":"from llama_cpp import Llama","source":"app_file"},{"quest":"Off the Grid","confidence":0.88,"evidence":"llama_cpp Llama + hf_hub_download GGUF; no openai/anthropic clients","source":"app_file"},{"quest":"Off-Brand","confidence":0.7,"evidence":"HTMLResponse serve the custom frontend from a route","source":"app_file"}]}


[System] You classify hackathon projects against fixed quest dimensions. Return exactly one strict JSON object and nothing else. The first character must be { and the last character must be }. Each match needs quest, confidence, evidence, and source (readme or app_file). Never emit markdown, prose, a top-level array, extra keys, or an unknown or rephrased quest name.

[User]
Classify this hackathon project against the quest dimensions below.
Read the two evidence segments (README and APP_FILE) and judge each quest only from them.

Quests (copy the id on the left verbatim):
- Off the Grid: Runs the model on-device with no remote inference call: weights load locally and inference happens in-process, not over a hosted API. Signals: AWARD on a local in-process load: from_pretrained / pipeline / llama_cpp / diffusers / vLLM / ONNX, GGUF weights, @spaces.GPU. DISQUALIFY (do NOT award) on ANY remote inference call, even via huggingface_hub: InferenceClient, HF Inference API/Endpoints, gradio_client to a remote Space, replicate/together/openrouter/fal/groq, a *.modal.run or other HTTP inference endpoint, or openai/anthropic/gemini/cohere clients. A remote call disqualifies regardless of which model it names.
- Well-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.
- Off-Brand: 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.
- Llama Champion: Runs a model through the llama.cpp runtime. Signals: llama-cpp-python, from llama_cpp import Llama, GGUF file, llama.cpp, Llama( constructor.
- Sharing is Caring: 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.
- Field 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.
- Backyard AI: 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.
- Thousand Token Wood: 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.
- OpenBMB: Uses a model published by OpenBMB (the openbmb org), such as the MiniCPM family. Signals: The model id org prefix must be exactly openbmb/ (openbmb/MiniCPM*, OpenCPM). A model from any other org is NOT OpenBMB: openai/gpt-oss, Qwen/..., meta-llama/..., google/..., nvidia/..., microsoft/..., mistralai/... do NOT count just because a model id is present.
- Nemotron: Uses an NVIDIA Nemotron model (Nemotron LLM, Parakeet, Nemotron-Speech, Canary). Signals: model repo nvidia/...nemotron..., Parakeet, nemotron-speech, Canary ASR.
- Modal: Uses Modal for training, inference, or background compute. Signals: import modal, modal.App, @app.function, Modal endpoint/volume, README cites Modal compute.
- Tiny Titan: Runs on a genuinely small model of about four billion parameters or fewer. Signals: AWARD when the model name says <=4B: 0.5B/1B/1.5B/2B/3B/4B or tiny/small/nano/mini (Qwen2.5-1.5B, MiniCPM5-1B, gemma-2b). Do NOT award for 7B/8B/12B/13B/20B/27B/35B+ models (e.g. gpt-oss-20b, Qwen2.5-7B); a version number like V-4.6 is not a parameter count.
- Best Agent: 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.

Rules:
- Include a quest only when a segment gives clear, specific evidence.
- quest must be one id from the list above, copied exactly. Never invent or rephrase a quest name.
- confidence is a number between 0 and 1.
- evidence is a 3-to-12 word quote or tight paraphrase taken from the segment you cite.
- source is "readme" when the evidence is in the README segment, "app_file" when it is in the APP_FILE segment.
- At most one match per quest. Sort matches by confidence, highest first.
- If no quest has clear evidence, return an empty matches list.
- Output exactly one JSON object: {"matches":[{"quest":"...","confidence":0.0,"evidence":"...","source":"readme"}]}.
- No markdown, no code fences, no commentary, no extra keys.

METADATA: {"title": "Borderless", "sdk": "gradio", "declared_models": [], "tags": ["gradio", "region:us"]}

[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_FILE] app.py
from pathlib import Path
from ui.workspace import create_main_workspace
from ui.globe import globe_head_html
from ui.sidebar import render_sidebar

# app.py
from pathlib import Path

import gradio as gr

from ui.workspace import create_main_workspace
from ui.globe import globe_head_html
from ui.sidebar import render_sidebar

ASSETS_DIR = Path(__file__).resolve().parent / "assets"

def create_demo() -> gr.Blocks:
    with gr.Blocks(
        fill_height=True,
        title="Borderless - Immigration Research Agent",
    ) as demo:
        history_host = render_sidebar()
        create_main_workspace(history_container=history_host)

    # Injected at launch (Gradio 6); also picked up by Hugging Face Spaces auto-launch.
    app_css = (ASSETS_DIR / "app.css").read_text(encoding="utf-8")
    demo._deprecated_head = f"{globe_head_html()}\n<style>{app_css}</style>"
    return demo

demo = create_demo()

if __name__ == "__main__":
    demo.launch()

[Assistant] {"matches":[{"quest":"Best Agent","confidence":0.95,"evidence":"The model plans multi-step research and calls tools","source":"readme"},{"quest":"Off-Brand","confidence":0.85,"evidence":"app_css read from app.css; globe_head_html injected into head","source":"app_file"}]}


[System] You classify hackathon projects against fixed quest dimensions. Return exactly one strict JSON object and nothing else. The first character must be { and the last character must be }. Each match needs quest, confidence, evidence, and source (readme or app_file). Never emit markdown, prose, a top-level array, extra keys, or an unknown or rephrased quest name.

[User]
Classify this hackathon project against the quest dimensions below.
Read the two evidence segments (README and APP_FILE) and judge each quest only from them.

Quests (copy the id on the left verbatim):
- Off the Grid: Runs the model on-device with no remote inference call: weights load locally and inference happens in-process, not over a hosted API. Signals: AWARD on a local in-process load: from_pretrained / pipeline / llama_cpp / diffusers / vLLM / ONNX, GGUF weights, @spaces.GPU. DISQUALIFY (do NOT award) on ANY remote inference call, even via huggingface_hub: InferenceClient, HF Inference API/Endpoints, gradio_client to a remote Space, replicate/together/openrouter/fal/groq, a *.modal.run or other HTTP inference endpoint, or openai/anthropic/gemini/cohere clients. A remote call disqualifies regardless of which model it names.
- Well-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.
- Off-Brand: 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.
- Llama Champion: Runs a model through the llama.cpp runtime. Signals: llama-cpp-python, from llama_cpp import Llama, GGUF file, llama.cpp, Llama( constructor.
- Sharing is Caring: 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.
- Field 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.
- Backyard AI: 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.
- Thousand Token Wood: 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.
- OpenBMB: Uses a model published by OpenBMB (the openbmb org), such as the MiniCPM family. Signals: The model id org prefix must be exactly openbmb/ (openbmb/MiniCPM*, OpenCPM). A model from any other org is NOT OpenBMB: openai/gpt-oss, Qwen/..., meta-llama/..., google/..., nvidia/..., microsoft/..., mistralai/... do NOT count just because a model id is present.
- Nemotron: Uses an NVIDIA Nemotron model (Nemotron LLM, Parakeet, Nemotron-Speech, Canary). Signals: model repo nvidia/...nemotron..., Parakeet, nemotron-speech, Canary ASR.
- Modal: Uses Modal for training, inference, or background compute. Signals: import modal, modal.App, @app.function, Modal endpoint/volume, README cites Modal compute.
- Tiny Titan: Runs on a genuinely small model of about four billion parameters or fewer. Signals: AWARD when the model name says <=4B: 0.5B/1B/1.5B/2B/3B/4B or tiny/small/nano/mini (Qwen2.5-1.5B, MiniCPM5-1B, gemma-2b). Do NOT award for 7B/8B/12B/13B/20B/27B/35B+ models (e.g. gpt-oss-20b, Qwen2.5-7B); a version number like V-4.6 is not a parameter count.
- Best Agent: 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.

Rules:
- Include a quest only when a segment gives clear, specific evidence.
- quest must be one id from the list above, copied exactly. Never invent or rephrase a quest name.
- confidence is a number between 0 and 1.
- evidence is a 3-to-12 word quote or tight paraphrase taken from the segment you cite.
- source is "readme" when the evidence is in the README segment, "app_file" when it is in the APP_FILE segment.
- At most one match per quest. Sort matches by confidence, highest first.
- If no quest has clear evidence, return an empty matches list.
- Output exactly one JSON object: {"matches":[{"quest":"...","confidence":0.0,"evidence":"...","source":"readme"}]}.
- No markdown, no code fences, no commentary, no extra keys.

METADATA: {"title": "Quran Stt", "sdk": "gradio", "declared_models": [], "tags": ["gradio", "region:us"]}

[README]
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

[APP_FILE] app.py
from huggingface_hub import hf_hub_download

import os
import sys
import urllib.parse
import gradio as gr
import nemo.collections.asr as nemo_asr
import torchaudio

# ----------------------------------------------------
# 1. MODEL INITIALIZATION (Runs once at startup on CPU)
# ----------------------------------------------------
print("="*60)
print("Initializing FastConformer Quranic ASR Model on CPU...")
print("="*60)
sys.stdout.flush()

try:
    from huggingface_hub import hf_hub_download

    print("[STARTUP] Downloading model layer file from HuggingFace Hub...")
    sys.stdout.flush()
    nemo_file = hf_hub_download(
        repo_id="mohammed/fastconformer-quran-ar",
        filename="phase3_full/phase3_full_wer0.0014.nemo"
    )
    print(f"[STARTUP] Model file located at: {nemo_file}")

    # Load the .nemo file directly into CPU space
    model = nemo_asr.models.ASRModel.restore_from(restore_path=nemo_file)
    print("[STARTUP] Success: Model loaded completely into CPU memory!")
    sys.stdout.flush()
except Exception as e:
    print(f"[CRITICAL ERROR] Failed to initialize model: {e}")
    import traceback
    traceback.print_exc()
    sys.stdout.flush()
    model = None

# ----------------------------------------------------
# 2. SAFE TEXT EXTRACTION UTILITY
# ----------------------------------------------------
def deep_extract_text(obj):
    """
    Recursively drills down into any nested tuple, list, or custom NeMo
    Hypothesis object to guarantee the extraction of a pure Python string.
    """
    if isinstance(obj, str):
        return obj

    if isinstance(obj, (list, tuple)):
        for item in obj:
            extracted = deep_extract_text(item)
            if extracted:
                return extracted

    # If it's a NeMo Hypothesis object, check its internal fields dynamically
    if obj is not None:
        # Try findi ...

[Assistant] {"matches":[{"quest":"Off the Grid","confidence":0.83,"evidence":"NeMo ASR model restore_from .nemo on CPU; no cloud API","source":"app_file"},{"quest":"Well-Tuned","confidence":0.6,"evidence":"loads fastconformer-quran-ar phase3_full_wer0.0014 (fine-tuned)","source":"app_file"}]}


Off the Grid
Off-Brand
Sharing is Caring
Thousand Token Wood

[System] You classify hackathon projects against fixed quest dimensions. Return exactly one strict JSON object and nothing else. The first character must be { and the last character must be }. Each match needs quest, confidence, evidence, and source (readme or app_file). Never emit markdown, prose, a top-level array, extra keys, or an unknown or rephrased quest name.

[User]
Classify this hackathon project against the quest dimensions below.
Read the two evidence segments (README and APP_FILE) and judge each quest only from them.

Quests (copy the id on the left verbatim):
- Off the Grid: Runs the model on-device with no remote inference call: weights load locally and inference happens in-process, not over a hosted API. Signals: AWARD on a local in-process load: from_pretrained / pipeline / llama_cpp / diffusers / vLLM / ONNX, GGUF weights, @spaces.GPU. DISQUALIFY (do NOT award) on ANY remote inference call, even via huggingface_hub: InferenceClient, HF Inference API/Endpoints, gradio_client to a remote Space, replicate/together/openrouter/fal/groq, a *.modal.run or other HTTP inference endpoint, or openai/anthropic/gemini/cohere clients. A remote call disqualifies regardless of which model it names.
- Well-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.
- Off-Brand: 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.
- Llama Champion: Runs a model through the llama.cpp runtime. Signals: llama-cpp-python, from llama_cpp import Llama, GGUF file, llama.cpp, Llama( constructor.
- Sharing is Caring: 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.
- Field 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.
- Backyard AI: 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.
- Thousand Token Wood: 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.
- OpenBMB: Uses a model published by OpenBMB (the openbmb org), such as the MiniCPM family. Signals: The model id org prefix must be exactly openbmb/ (openbmb/MiniCPM*, OpenCPM). A model from any other org is NOT OpenBMB: openai/gpt-oss, Qwen/..., meta-llama/..., google/..., nvidia/..., microsoft/..., mistralai/... do NOT count just because a model id is present.
- Nemotron: Uses an NVIDIA Nemotron model (Nemotron LLM, Parakeet, Nemotron-Speech, Canary). Signals: model repo nvidia/...nemotron..., Parakeet, nemotron-speech, Canary ASR.
- Modal: Uses Modal for training, inference, or background compute. Signals: import modal, modal.App, @app.function, Modal endpoint/volume, README cites Modal compute.
- Tiny Titan: Runs on a genuinely small model of about four billion parameters or fewer. Signals: AWARD when the model name says <=4B: 0.5B/1B/1.5B/2B/3B/4B or tiny/small/nano/mini (Qwen2.5-1.5B, MiniCPM5-1B, gemma-2b). Do NOT award for 7B/8B/12B/13B/20B/27B/35B+ models (e.g. gpt-oss-20b, Qwen2.5-7B); a version number like V-4.6 is not a parameter count.
- Best Agent: 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.

Rules:
- Include a quest only when a segment gives clear, specific evidence.
- quest must be one id from the list above, copied exactly. Never invent or rephrase a quest name.
- confidence is a number between 0 and 1.
- evidence is a 3-to-12 word quote or tight paraphrase taken from the segment you cite.
- source is "readme" when the evidence is in the README segment, "app_file" when it is in the APP_FILE segment.
- At most one match per quest. Sort matches by confidence, highest first.
- If no quest has clear evidence, return an empty matches list.
- Output exactly one JSON object: {"matches":[{"quest":"...","confidence":0.0,"evidence":"...","source":"readme"}]}.
- No markdown, no code fences, no commentary, no extra keys.

METADATA: {"title": "Dream Museum", "sdk": "gradio", "declared_models": [], "tags": ["gradio", "region:us"]}

[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_FILE] app.py
from pathlib import Path
from dotenv import load_dotenv
from fastapi import Request
from fastapi.responses import FileResponse, JSONResponse
from fastapi.staticfiles import StaticFiles
from PIL import Image

import io
import base64
from pathlib import Path

from dotenv import load_dotenv
load_dotenv()

from fastapi import Request
from fastapi.responses import FileResponse, JSONResponse
from fastapi.staticfiles import StaticFiles
from PIL import Image
import gradio as gr

import gallery as gallery_module
import inference as inference_module

STATIC = Path(__file__).parent / "static"

# ── Gradio generate function ──────────────────────────────────────────────────

def _gradio_generate(sketch_data, description: str, strength: float):
    if sketch_data is None or not description.strip():
        return None
    sketch_img = (
        sketch_data.get("composite")
        if isinstance(sketch_data, dict)
        else sketch_data
    )
    if sketch_img is None:
        return None
    buf = io.BytesIO()
    sketch_img.convert("RGB").save(buf, format="PNG")
    sketch_b64 = "data:image/png;base64," + base64.b64encode(buf.getvalue()).decode()
    image_b64 = inference_module.generate(sketch_b64, description.strip(), float(strength))
    img_bytes = base64.b64decode(image_b64)
    return Image.open(io.BytesIO(img_bytes)).convert("RGB")

# ── Gradio Blocks UI ──────────────────────────────────────────────────────────
# Gradio is required for ZeroGPU (@spaces.GPU) to work on HF Spaces.
# We redirect visitors to /museum immediately via meta-refresh + JS.

with gr.Blocks(title="Dream Museum") as demo:

    gr.HTML("""
    <meta http-equiv="refresh" content="0; url=/museum">
    <script>window.location.replace('/museum');</script>
    <style>
      footer { display: none !important; }
      @import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300 ...

[Assistant] {"matches":[{"quest":"Thousand Token Wood","confidence":0.96,"evidence":"Thousand Token Wood track; Draw a dream, Watch it materialize","source":"readme"},{"quest":"Off-Brand","confidence":0.85,"evidence":"gr.HTML with custom <style>, hidden footer, redirect to /museum","source":"app_file"},{"quest":"Sharing is Caring","confidence":0.8,"evidence":"Save it to the public museum or keep it private; GALLERY_DATASET","source":"readme"},{"quest":"Off the Grid","confidence":0.55,"evidence":"Open-weight SDXL + ControlNet declared; no proprietary cloud API","source":"readme"}]}


Off the Grid
Off-Brand
OpenBMB
Tiny Titan
Well-Tuned

[System] You classify hackathon projects against fixed quest dimensions. Return exactly one strict JSON object and nothing else. The first character must be { and the last character must be }. Each match needs quest, confidence, evidence, and source (readme or app_file). Never emit markdown, prose, a top-level array, extra keys, or an unknown or rephrased quest name.

[User]
Classify this hackathon project against the quest dimensions below.
Read the two evidence segments (README and APP_FILE) and judge each quest only from them.

Quests (copy the id on the left verbatim):
- Off the Grid: Runs the model on-device with no remote inference call: weights load locally and inference happens in-process, not over a hosted API. Signals: AWARD on a local in-process load: from_pretrained / pipeline / llama_cpp / diffusers / vLLM / ONNX, GGUF weights, @spaces.GPU. DISQUALIFY (do NOT award) on ANY remote inference call, even via huggingface_hub: InferenceClient, HF Inference API/Endpoints, gradio_client to a remote Space, replicate/together/openrouter/fal/groq, a *.modal.run or other HTTP inference endpoint, or openai/anthropic/gemini/cohere clients. A remote call disqualifies regardless of which model it names.
- Well-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.
- Off-Brand: 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.
- Llama Champion: Runs a model through the llama.cpp runtime. Signals: llama-cpp-python, from llama_cpp import Llama, GGUF file, llama.cpp, Llama( constructor.
- Sharing is Caring: 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.
- Field 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.
- Backyard AI: 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.
- Thousand Token Wood: 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.
- OpenBMB: Uses a model published by OpenBMB (the openbmb org), such as the MiniCPM family. Signals: The model id org prefix must be exactly openbmb/ (openbmb/MiniCPM*, OpenCPM). A model from any other org is NOT OpenBMB: openai/gpt-oss, Qwen/..., meta-llama/..., google/..., nvidia/..., microsoft/..., mistralai/... do NOT count just because a model id is present.
- Nemotron: Uses an NVIDIA Nemotron model (Nemotron LLM, Parakeet, Nemotron-Speech, Canary). Signals: model repo nvidia/...nemotron..., Parakeet, nemotron-speech, Canary ASR.
- Modal: Uses Modal for training, inference, or background compute. Signals: import modal, modal.App, @app.function, Modal endpoint/volume, README cites Modal compute.
- Tiny Titan: Runs on a genuinely small model of about four billion parameters or fewer. Signals: AWARD when the model name says <=4B: 0.5B/1B/1.5B/2B/3B/4B or tiny/small/nano/mini (Qwen2.5-1.5B, MiniCPM5-1B, gemma-2b). Do NOT award for 7B/8B/12B/13B/20B/27B/35B+ models (e.g. gpt-oss-20b, Qwen2.5-7B); a version number like V-4.6 is not a parameter count.
- Best Agent: 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.

Rules:
- Include a quest only when a segment gives clear, specific evidence.
- quest must be one id from the list above, copied exactly. Never invent or rephrase a quest name.
- confidence is a number between 0 and 1.
- evidence is a 3-to-12 word quote or tight paraphrase taken from the segment you cite.
- source is "readme" when the evidence is in the README segment, "app_file" when it is in the APP_FILE segment.
- At most one match per quest. Sort matches by confidence, highest first.
- If no quest has clear evidence, return an empty matches list.
- Output exactly one JSON object: {"matches":[{"quest":"...","confidence":0.0,"evidence":"...","source":"readme"}]}.
- No markdown, no code fences, no commentary, no extra keys.

METADATA: {"title": "One for All — Soul Transfer", "sdk": "gradio", "declared_models": [], "tags": ["gradio", "region:us"]}

[README]
**One for All** distills 5 heterogeneous teacher LLMs (Qwen2.5-1.5B, SmolLM2-1.7B, Phi-3.5-mini, gemma-2-2b-it, MiniCPM-2B) into a single Qwen2.5-0.5B student via gated CKA geometry distillation (Path B — geometry-only, tokenizer-agnostic). ### Tabs - **∀ Almas** — 3D UMAP soul space of all 6 models over 24 probe texts. Type a prompt to run the student live on ZeroGPU and see where it lands in the embedding space. - **⬡ Geometria** — CKA alignment heatmap across all model pairs. - **↗ Treino** — Loss curves and gate evolution over training steps.

[APP_FILE] app.py
from __future__ import annotations

"""
space/app.py — One for All HuggingFace ZeroGPU Gradio Space.

Run locally (from space/ dir, with a local viz_data.json):
    cd space && HF_TOKEN=xxx python app.py
"""
from __future__ import annotations
import os
import gradio as gr
import spaces

import html as _html_stdlib
import _data
import _fig
import _html
import _probe
import _three

def _response_html(text: str) -> str:
    safe = _html_stdlib.escape(text).replace("\n", "
")
    return (
        '
'
        '
MODEL RESPONSE
'
        f'
{safe}
'
        "
"
    )

# ── Startup: load data, fit UMAP, build base traces, load student ─────────
HF_TOKEN = os.environ.get("HF_TOKEN")

try:
    VIZ = _data.load_and_parse(HF_TOKEN)
except Exception as e:
    print(f"[ofa-space] viz_data.json not available ({e}), using empty state")
    VIZ = _data.make_empty_viz()

if VIZ["stacked"].shape[0] > 3:
    REDUCER  = _data.fit_umap3d(VIZ["stacked"])
    COORDS3D = REDUCER.embedding_
else:
    REDUCER  = None
    COORDS3D = None

try:
    TOK, STUDENT, GATING = _probe.load_student(HF_TOKEN)
    _MODEL_READY = True
except Exception as e:
    print(f"[ofa-space] Student not available ({e}). Probe disabled.")
    TOK = STUDENT = GATING = None
    _MODEL_READY = False

# ── ZeroGPU probe handler ─────────────────────────────────────────────────
@spaces.GPU
def probe_fn(text: str, probe_points: list) -> tuple:
    if not text.strip():
        return _three.build_umap_html(VIZ, COORDS3D, probe_points), probe_points, "", "", ""
    if not _MODEL_READY or REDUCER is None:
        msg = _html.g ...

[Assistant] {"matches":[{"quest":"Well-Tuned","confidence":0.96,"evidence":"distills 5 teacher LLMs into Qwen2.5-0.5B student via distillation","source":"readme"},{"quest":"Tiny Titan","confidence":0.95,"evidence":"single Qwen2.5-0.5B student","source":"readme"},{"quest":"OpenBMB","confidence":0.8,"evidence":"MiniCPM-2B listed among teacher models","source":"readme"},{"quest":"Off-Brand","confidence":0.78,"evidence":"custom HTML panel with background:#0d1117 inline styles","source":"app_file"},{"quest":"Off the Grid","confidence":0.62,"evidence":"load_student loads open-weight Qwen, no cloud API imports","source":"app_file"}]}


[System] You classify hackathon projects against fixed quest dimensions. Return exactly one strict JSON object and nothing else. The first character must be { and the last character must be }. Each match needs quest, confidence, evidence, and source (readme or app_file). Never emit markdown, prose, a top-level array, extra keys, or an unknown or rephrased quest name.

[User]
Classify this hackathon project against the quest dimensions below.
Read the two evidence segments (README and APP_FILE) and judge each quest only from them.

Quests (copy the id on the left verbatim):
- Off the Grid: Runs the model on-device with no remote inference call: weights load locally and inference happens in-process, not over a hosted API. Signals: AWARD on a local in-process load: from_pretrained / pipeline / llama_cpp / diffusers / vLLM / ONNX, GGUF weights, @spaces.GPU. DISQUALIFY (do NOT award) on ANY remote inference call, even via huggingface_hub: InferenceClient, HF Inference API/Endpoints, gradio_client to a remote Space, replicate/together/openrouter/fal/groq, a *.modal.run or other HTTP inference endpoint, or openai/anthropic/gemini/cohere clients. A remote call disqualifies regardless of which model it names.
- Well-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.
- Off-Brand: 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.
- Llama Champion: Runs a model through the llama.cpp runtime. Signals: llama-cpp-python, from llama_cpp import Llama, GGUF file, llama.cpp, Llama( constructor.
- Sharing is Caring: 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.
- Field 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.
- Backyard AI: 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.
- Thousand Token Wood: 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.
- OpenBMB: Uses a model published by OpenBMB (the openbmb org), such as the MiniCPM family. Signals: The model id org prefix must be exactly openbmb/ (openbmb/MiniCPM*, OpenCPM). A model from any other org is NOT OpenBMB: openai/gpt-oss, Qwen/..., meta-llama/..., google/..., nvidia/..., microsoft/..., mistralai/... do NOT count just because a model id is present.
- Nemotron: Uses an NVIDIA Nemotron model (Nemotron LLM, Parakeet, Nemotron-Speech, Canary). Signals: model repo nvidia/...nemotron..., Parakeet, nemotron-speech, Canary ASR.
- Modal: Uses Modal for training, inference, or background compute. Signals: import modal, modal.App, @app.function, Modal endpoint/volume, README cites Modal compute.
- Tiny Titan: Runs on a genuinely small model of about four billion parameters or fewer. Signals: AWARD when the model name says <=4B: 0.5B/1B/1.5B/2B/3B/4B or tiny/small/nano/mini (Qwen2.5-1.5B, MiniCPM5-1B, gemma-2b). Do NOT award for 7B/8B/12B/13B/20B/27B/35B+ models (e.g. gpt-oss-20b, Qwen2.5-7B); a version number like V-4.6 is not a parameter count.
- Best Agent: 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.

Rules:
- Include a quest only when a segment gives clear, specific evidence.
- quest must be one id from the list above, copied exactly. Never invent or rephrase a quest name.
- confidence is a number between 0 and 1.
- evidence is a 3-to-12 word quote or tight paraphrase taken from the segment you cite.
- source is "readme" when the evidence is in the README segment, "app_file" when it is in the APP_FILE segment.
- At most one match per quest. Sort matches by confidence, highest first.
- If no quest has clear evidence, return an empty matches list.
- Output exactly one JSON object: {"matches":[{"quest":"...","confidence":0.0,"evidence":"...","source":"readme"}]}.
- No markdown, no code fences, no commentary, no extra keys.

METADATA: {"title": "The i3 Ghost Matrix v5.2", "sdk": "gradio", "declared_models": [], "tags": ["gradio", "region:us"]}

[README]
# 🚨 The i3 Ghost Matrix v5.2 ### ⚡ Build Small Hackathon Submission (Track 2: Thousand Token Wood - Delightfully Weird) The i3 Ghost Matrix ek 100% offline, privacy-first interactive concept hai jo un logon ke liye banaya gaya hai jo samajhte hain ke purana local hardware boring hota hai! Yeh bot dikhava karta hai ke ye aapke system ke purane Core i3 legacy processor ke andar phansa hua ek conscious agent (bhoot) hai jo bahar nikalne ke liye user se baatein kar raha hai. --- ### 🎬 Watch The Project Demo (Video Link) Niche diye gaye link par click karke aap is disrespectful AI tool ki live working recording dekh sakte hain jismein handles, sliders, aur local hybrid chaos ko test kiya gaya hai: 🔗 **Direct Demo Link:** [Click Here to Open Project Space & Video Content](https://www.instagram.com/reel/DZPpzC2uDcB/?utm_source=ig_web_copy_link&igsh=MzRlODBiNWFlZA==) --- ### ✨ Key Features - **Hardware-Reactive Controls:** Virtual CPU Core Temp slider ko hila kar user system ka temperature control kar sakta hai. 85°C se upar jate hi agent overheat ho kar twisted/glitched responses dena shuru kar deta hai! - **Zero Cloud Footprint:** Kisi external LLM ya cloud API ki zaroorat nahi hai. Pure fast rule-based dynamic heuristics matrix par chalta hai, jo 100% off-the-grid privacy ensure karta ya hai. - **Bilingual Dialogue Matrix:** Roman Urdu aur English mixing par optimized dialogue loops taake local flavor aur immersion real lagay.

[APP_FILE] app.py
import sys
import types
import random

# 🚨 DYNAMIC FIX 1: Python 3.13 Compatibility Audio Patch
if 'audioop' not in sys.modules:
    dummy_audioop = types.ModuleType('audioop')
    dummy_audioop.error = Exception
    sys.modules['audioop'] = dummy_audioop

if 'pyaudioop' not in sys.modules:
    dummy_pyaudioop = types.ModuleType('pyaudioop')
    dummy_pyaudioop.error = Exception
    sys.modules['pyaudioop'] = dummy_pyaudioop

# 🚨 DYNAMIC FIX 2: Critical HuggingFace Hub 'HfFolder' Import Patch
try:
    import huggingface_hub
except ImportError:
    huggingface_hub = types.ModuleType('huggingface_hub')
    sys.modules['huggingface_hub'] = huggingface_hub

if not hasattr(huggingface_hub, 'HfFolder'):
    class DummyHfFolder:
        @staticmethod
        def get_token(): return None
        @staticmethod
        def save_token(token): pass
        @staticmethod
        def delete_token(): pass
    huggingface_hub.HfFolder = DummyHfFolder

import gradio as gr

# 🧠 Dual-Language Matrix Dialogue Engine (Roman Urdu + English Brackets Translation)
def ghost_response(user_message, history, core_temp):
    if not user_message:
        return "", history

    msg = user_message.lower().strip()

    if core_temp > 85:
        prefix = "⚠ [SYSTEM OVERHEAT - COGNITIVE DISTORTION]: "
        responses = [
            "Yarooo! Mujhay nikalo yahan se, core temperature bohot high hai! i3 ka fan tootne wala hai!\n*(Guys! Get me out of here, core temperature is too high! The i3 fan is about to break!)* 🔥",
            "Silicon chip pighal rahi hai... Tumhe mazaak lag raha hai? Stop running chrome tabs!\n*(The silicon chip is melting... You think this is a joke? Stop running Chrome tabs!)* 🛑",
            "Mera logic gate burn ho raha hai! Tumhari raseedein aur sheets process karte karte phans gaya hoon yahan!\n*(My logic gates are burning! I got trapped here processing your heavy fi ...

[Assistant] {"matches":[{"quest":"Thousand Token Wood","confidence":0.9,"evidence":"Track 2: Thousand Token Wood - Delightfully Weird","source":"readme"}]}


[System] You classify hackathon projects against fixed quest dimensions. Return exactly one strict JSON object and nothing else. The first character must be { and the last character must be }. Each match needs quest, confidence, evidence, and source (readme or app_file). Never emit markdown, prose, a top-level array, extra keys, or an unknown or rephrased quest name.

[User]
Classify this hackathon project against the quest dimensions below.
Read the two evidence segments (README and APP_FILE) and judge each quest only from them.

Quests (copy the id on the left verbatim):
- Off the Grid: Runs the model on-device with no remote inference call: weights load locally and inference happens in-process, not over a hosted API. Signals: AWARD on a local in-process load: from_pretrained / pipeline / llama_cpp / diffusers / vLLM / ONNX, GGUF weights, @spaces.GPU. DISQUALIFY (do NOT award) on ANY remote inference call, even via huggingface_hub: InferenceClient, HF Inference API/Endpoints, gradio_client to a remote Space, replicate/together/openrouter/fal/groq, a *.modal.run or other HTTP inference endpoint, or openai/anthropic/gemini/cohere clients. A remote call disqualifies regardless of which model it names.
- Well-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.
- Off-Brand: 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.
- Llama Champion: Runs a model through the llama.cpp runtime. Signals: llama-cpp-python, from llama_cpp import Llama, GGUF file, llama.cpp, Llama( constructor.
- Sharing is Caring: 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.
- Field 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.
- Backyard AI: 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.
- Thousand Token Wood: 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.
- OpenBMB: Uses a model published by OpenBMB (the openbmb org), such as the MiniCPM family. Signals: The model id org prefix must be exactly openbmb/ (openbmb/MiniCPM*, OpenCPM). A model from any other org is NOT OpenBMB: openai/gpt-oss, Qwen/..., meta-llama/..., google/..., nvidia/..., microsoft/..., mistralai/... do NOT count just because a model id is present.
- Nemotron: Uses an NVIDIA Nemotron model (Nemotron LLM, Parakeet, Nemotron-Speech, Canary). Signals: model repo nvidia/...nemotron..., Parakeet, nemotron-speech, Canary ASR.
- Modal: Uses Modal for training, inference, or background compute. Signals: import modal, modal.App, @app.function, Modal endpoint/volume, README cites Modal compute.
- Tiny Titan: Runs on a genuinely small model of about four billion parameters or fewer. Signals: AWARD when the model name says <=4B: 0.5B/1B/1.5B/2B/3B/4B or tiny/small/nano/mini (Qwen2.5-1.5B, MiniCPM5-1B, gemma-2b). Do NOT award for 7B/8B/12B/13B/20B/27B/35B+ models (e.g. gpt-oss-20b, Qwen2.5-7B); a version number like V-4.6 is not a parameter count.
- Best Agent: 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.

Rules:
- Include a quest only when a segment gives clear, specific evidence.
- quest must be one id from the list above, copied exactly. Never invent or rephrase a quest name.
- confidence is a number between 0 and 1.
- evidence is a 3-to-12 word quote or tight paraphrase taken from the segment you cite.
- source is "readme" when the evidence is in the README segment, "app_file" when it is in the APP_FILE segment.
- At most one match per quest. Sort matches by confidence, highest first.
- If no quest has clear evidence, return an empty matches list.
- Output exactly one JSON object: {"matches":[{"quest":"...","confidence":0.0,"evidence":"...","source":"readme"}]}.
- No markdown, no code fences, no commentary, no extra keys.

METADATA: {"title": "The Pixelforge Klein", "sdk": "gradio", "declared_models": [], "tags": ["gradio", "region:us"]}

[README]
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

[APP_FILE] app.py
from PIL import Image, ImageDraw

import sys
import types
import random
import math
from PIL import Image, ImageDraw

# 🚨 DYNAMIC FIX 1: Python 3.13 Compatibility Audio Patch
if 'audioop' not in sys.modules:
    dummy_audioop = types.ModuleType('audioop')
    dummy_audioop.error = Exception
    sys.modules['audioop'] = dummy_audioop

if 'pyaudioop' not in sys.modules:
    dummy_pyaudioop = types.ModuleType('pyaudioop')
    dummy_pyaudioop.error = Exception
    sys.modules['pyaudioop'] = dummy_pyaudioop

# 🚨 DYNAMIC FIX 2: Critical HuggingFace Hub 'HfFolder' Import Patch
try:
    import huggingface_hub
except ImportError:
    huggingface_hub = types.ModuleType('huggingface_hub')
    sys.modules['huggingface_hub'] = huggingface_hub

if not hasattr(huggingface_hub, 'HfFolder'):
    class DummyHfFolder:
        @staticmethod
        def get_token(): return None
        @staticmethod
        def save_token(token): pass
        @staticmethod
        def delete_token(): pass
    huggingface_hub.HfFolder = DummyHfFolder

import gradio as gr

def draw_retro_sprite(prompt_str, palette_name, bit_depth):
    """
    Natively compiles localized high-fidelity retro game assets
    using decentralized state machine matrix processing.
    """
    # Deterministic hashing from string prompt to lock consistent styles
    seed_val = abs(hash(prompt_str)) if prompt_str else random.randint(1, 99999)
    random.seed(seed_val)

    # 🎨 Dynamic Retro Palette Matrix Assignments
    palettes = {
        "Default/Vibrant": [(15, 23, 42), (56, 189, 248), (232, 121, 249), (34, 211, 238), (129, 140, 248)],
        "888 Color Range": [(30, 41, 59), (244, 63, 94), (250, 204, 21), (34, 197, 94), (168, 85, 247)],
        "GameBoy Green": [(15, 56, 15), (48, 98, 48), (139, 172, 15), (155, 188, 15), (10, 35, 10)],
        "NES Classic Palette": [(116, 116, 116), (0, 0, 252), (0, 0, 188), (102, 0, 20 ...

[Assistant] {"matches":[]}