Skip to content
CodexgreenfieldWeb7 files · +2049 −62

Build a browser-side multilingual WSD Gradio Space with Tiny Aya ONNX + BabelNet

Session from sense-garden-traces on Hugging Face by build-small-hackathon · CC-BY-4.0 · condensed by Coders Talk

46msession
1interventions
GOAL

Build a hackathon Gradio Space demo where a user picks a language, highlights a word in a sentence, and gets its sense disambiguated either by picking a BabelNet synset or generating a gloss, using Transformers.js models running in-browser.

  1. Prompt · +0
    Build a Gradio Space WSD tool using Tiny Aya ONNX via Transformers.js, BabelNet for synsets/glosses (WordNet-sourced preferred, few API calls), multilingual input, and a browser-based UI.
  2. Agent did · +0m
    Explored repo examples, read model READMEs, then built app.py (FastAPI+Gradio Server), index.html, static/app.js and styles.css: browser-side Transformers.js loading Tiny Aya and GTE, backend BabelNet caching endpoint.
  3. Fail · +7m
    Local server startup repeatedly failed on Windows: missing python on PATH, missing requests module, Start-Process PATH key collisions, background jobs dying.
  4. Agent did · +8m
    Swapped requests for stdlib urllib, tried multiple background-launch workarounds (Start-Job, cmd start), eventually verified the server via a foreground timeout probe.
  5. Prompt · +20m
    Got a WebGPU OrtRun error 'Could not disambiguate' when trying an Italian sentence.
  6. Intervention · +21m
    Developer stopped the agent from shrinking the candidate cap (32→12) and truncating glosses in the MCQA prompt, saying it strips valuable semantic context.
    Why: shortening the candidate list and the prompts is not the answer, as it strips the model of valuable semantic context
  7. Agent did · +23m
    Reverted the candidate cap to 32 and restored full glosses in the prompt; kept the real fix of running GTE on WASM while Tiny Aya stays on WebGPU, isolating GPU buffer pressure.
  8. Prompt · +34m
    Italian sentence loaded BabelNet fallbacks even though WordNet synsets existed (visible in output but not detected as WordNet); also wants candidates ordered by semantic similarity.
  9. Agent did · +34m
    Broadened WordNet-source detection to check full synset payloads (not just the initial ID search) for sources like IWN/OMWN_*/MCR_*, and reordered the displayed candidate list by GTE similarity rank while preserving original option numbers.
  10. Break · 131h 40m away, not counted
  11. Agent did · +36m
    Added an info modal explaining the tool, the need to manually lemmatize for BabelNet mode, and the ~5-6GB first-load model download size.
  12. Break · 4h 45m away, not counted
  13. Agent did · +41m
    Created the Space under build-small-hackathon org via Hub API, wrote README with hackathon track/badges, set BABELNET_API_KEY as a Space secret, uploaded only required files, verified RUNNING on cpu-basic, and wrote a PROJECT_HANDOFF.md summary for a future blog-writing agent.
  14. Outcome · +46m
    Space deployed and RUNNING at build-small-hackathon/sense-garden on cpu-basic, with 8 files pushed and BABELNET_API_KEY secret set; HTTP 200 confirmed.
VERDICT

Next time I'd specify upfront that the model runs client-side so we should keep full semantic context (all synsets, full glosses) even under credit/perf constraints — the agent's instinct to shrink things for a WebGPU error nearly cost us disambiguation quality. Stopping it from truncating the candidate list and glosses was the correction that mattered; the actual fix (isolating GTE on WASM, away from WebGPU) was unrelated and much more targeted. Windows background-process launching wasted a lot of turns for something that should have been a non-issue on the actual Space deployment.

I tried this · 0

Discussion · 0

How Builds work