Add JavaScript API (WebAssembly) for Google MedAsr model - #2954
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughAdds support for MedASR (Medical Speech Recognition) CTC models to sherpa-onnx by introducing a new Node.js test script for offline MedASR decoding, corresponding documentation, and WASM/JavaScript configuration structures with memory handling. CI tests are extended to validate MedASR and other model scenarios. A lexicon entry is removed from the TTS test configuration. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
💤 Files with no reviewable changes (1)
🧰 Additional context used🧬 Code graph analysis (2)wasm/asr/sherpa-onnx-asr.js (1)
wasm/nodejs/sherpa-onnx-wasm-nodejs.cc (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @csukuangfj, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly expands the capabilities of the JavaScript (WebAssembly) API by integrating support for the Google MedAsr model. This addition allows developers to leverage the MedAsr model for offline speech recognition directly within Node.js applications. The changes encompass the necessary configuration handling, a practical usage example, and updates to the automated testing pipeline to ensure robustness. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds JavaScript API support for the Google MedASR model, including a new Node.js example, updates to the CI test script, and necessary changes to the WebAssembly bindings. The implementation is consistent with the existing codebase structure. My review includes a couple of suggestions for improving script efficiency and code cleanliness in the new example file. Overall, the changes look good.
| curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-medasr-ctc-en-int8-2025-12-25.tar.bz2 | ||
| tar xvf sherpa-onnx-medasr-ctc-en-int8-2025-12-25.tar.bz2 | ||
| rm sherpa-onnx-medasr-ctc-en-int8-2025-12-25.tar.bz2 |
There was a problem hiding this comment.
For efficiency and simplicity, you can download and extract the model in a single command by piping curl to tar. This avoids writing the compressed archive to disk.
| curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-medasr-ctc-en-int8-2025-12-25.tar.bz2 | |
| tar xvf sherpa-onnx-medasr-ctc-en-int8-2025-12-25.tar.bz2 | |
| rm sherpa-onnx-medasr-ctc-en-int8-2025-12-25.tar.bz2 | |
| curl -SL https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-medasr-ctc-en-int8-2025-12-25.tar.bz2 | tar xvjf - |
| const fs = require('fs'); | ||
| const {Readable} = require('stream'); | ||
| const wav = require('wav'); |
Summary by CodeRabbit
New Features
Tests
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.