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
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.
- +0Prompt · +0Build 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.
- +0mAgent did · +0mExplored 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.
- +7mFail · +7mLocal server startup repeatedly failed on Windows: missing python on PATH, missing requests module, Start-Process PATH key collisions, background jobs dying.
- +8mAgent did · +8mSwapped requests for stdlib urllib, tried multiple background-launch workarounds (Start-Job, cmd start), eventually verified the server via a foreground timeout probe.
- +20mPrompt · +20mGot a WebGPU OrtRun error 'Could not disambiguate' when trying an Italian sentence.
- +21mIntervention · +21mDeveloper 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
- +23mAgent did · +23mReverted 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.
- +34mPrompt · +34mItalian sentence loaded BabelNet fallbacks even though WordNet synsets existed (visible in output but not detected as WordNet); also wants candidates ordered by semantic similarity.
- +34mAgent did · +34mBroadened 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.
- Break · 131h 40m away, not counted
- +36mAgent did · +36mAdded an info modal explaining the tool, the need to manually lemmatize for BabelNet mode, and the ~5-6GB first-load model download size.
- Break · 4h 45m away, not counted
- +41mAgent did · +41mCreated 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.
- +46mOutcome · +46mSpace 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.
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.