Skip to content

feat(space): add a Hugging Face Space demo - #30

Open
FenjuFu wants to merge 1 commit into
mainfrom
feat/hf-space-demo
Open

FenjuFu wants to merge 1 commit into
mainfrom
feat/hf-space-demo

Conversation

@FenjuFu

@FenjuFu FenjuFu commented Sep 28, 2026

Copy link
Copy Markdown
Member

Summary

Adds spaces/domux-demo, a Gradio demo that can run as a Hugging Face Space so people can try Domux without deploying it, as #10 asks (in the spirit of baidu/Unlimited-OCR).

  • Type a command, or pick one of 8 examples taken from the README and the four test-set categories. The demo shows the parsed action|device|attribute|value|unit|room|floor slots as a table, the raw model output, whether every line has 7 fields (same rule as eval/run_eval.py, including the & separator), and the latency.
  • Two backends:
    • Local model (default). Loads iFlytekOpenSource/Domux with transformers in BF16, pinned to revision 6c71a32f. This mirrors cases/domux-4057-full-eval/eval_direct.py (transformers 5.15.1, AutoModelForCausalLM, greedy decoding, 256 new tokens), which scored 97.58% on the full test set. On a ZeroGPU Space each request is wrapped in @spaces.GPU.
    • OpenAI-compatible endpoint. Used when DOMUX_API_BASE is set. It calls a vLLM or SGLang server with the same request as eval/run_eval.py, so the Space can run on free CPU hardware.
  • .github/workflows/sync-space.yml uploads the directory to the Space on changes to main or on manual dispatch. It targets iFlytekOpenSource/Domux-Demo unless the HF_SPACE_ID variable says otherwise, and skips with a notice when the HF_TOKEN secret is not configured.
  • .github/workflows/space-check.yml runs the demo tests on PRs.
  • A pointer is added in the Demo section of both READMEs, plus an Unreleased CHANGELOG entry.

Closes #10

Maintainer setup

  1. Create the Space (e.g. iFlytekOpenSource/Domux-Demo) and pick ZeroGPU hardware, or CPU with DOMUX_API_BASE.
  2. Add the HF_TOKEN secret (and HF_SPACE_ID if the name differs).
  3. Run Sync Hugging Face Space once.

Testing

  • pytest spaces/domux-demo/tests: 9 passed. Covers slot splitting and format flags, input limits, the endpoint request shape, backend selection, and building the Gradio app with gradio 6.28.0.
  • Ran app.py locally against a stub OpenAI-compatible server and used the UI in a browser. The multi-room example rendered as 4 slot rows with a valid-format badge, and an empty submit shows the validation message.
  • The Space card (spaces/domux-demo/README.md) parses with huggingface_hub.SpaceCard, and zero-a10g is a valid SpaceHardware value.
  • Not tested: the local GPU path. I have no GPU here, so it has not been run end to end. It follows the loading and generation code of cases/domux-4057-full-eval line for line, and the first Space build will exercise it.

Add spaces/domux-demo, a Gradio app that turns a smart-home command into
the 7-field slots and shows the raw output, a format check and latency.
It loads iFlytekOpenSource/Domux with transformers at the revision used by
cases/domux-4057-full-eval (ZeroGPU on Spaces), or calls an
OpenAI-compatible vLLM/SGLang endpoint when DOMUX_API_BASE is set.

Add a workflow that syncs the directory to the Space when HF_TOKEN is
configured, and a PR check for the demo.

Closes #10

Signed-off-by: FenjuFu <fufenjupku@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Create demo environments for users via Hugging Face Spaces

1 participant