Comments (5)
Have you tried using Postman code snippets for making Node.js requests?
from whisper-asr-webservice.
Post code pls
from whisper-asr-webservice.
I'm using NodeJS and the form-data package to send a WAV buffer to the ASR endpoint. I know the audio coming into the function is good because I can use it via Postman with the Whisper endpoint and it works great.
async function
transcribeAudio(socket, audioBuffer) {
const formData = new FormData();
formData.append("audio_file", audioBuffer, {
contentType: "audio/wav",
filename: "audio.wav",
});
const whisperUrl =
"http://192.168.0.10:9000/asr?task=transcribe&language=en&encode=true&output=json&word_timestamps=false";
try {
const response = await fetch(whisperUrl, {
method: "POST",
body: formData,
headers: formData.getHeaders(),
});
if (!response.ok) {
socket.emit(
"clientConsole",
`Whisper HTTP error! Status: ${response.status}`
);
}
const data = await response.json();
const transcription = data.text;
console.log("Transcribed text:", transcription);
socket.emit("clientConsole", `Transcribed text: ${transcription}`);
} catch (error) {
console.error("Error during Whisper transcription: ", error);
return null;
}
}
`
But I get "undefined" returned and a "Did not find boundary character 91 at index 2" in the logs.
This is the first time I'm POSTing with form data in Node so I certainly could be crafting something wrong.
(sorry for the bad formatting - on my phone)
from whisper-asr-webservice.
No!! I didn't know that was an option! That's a great idea. I'll try that when I get home. At very least, even if that fails, it should make it clear if perhaps I'm missing a step (since I'm using a legit file in Postman vs a buffer (same audio data) in the code). Thanks for the idea!
from whisper-asr-webservice.
Thanks so much for the recommendation! I was able to create the following NodeJS code that accepts a WAV buffer. Works perfectly. I think switching to axios from the native fetch did the trick:
async function transcribeAudio(buffer) {
let data = new FormData();
data.append('audio_file', buffer, 'file.wav');
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'http://192.168.0.10:9000/asr?task=transcribe&language=en&encode=true&output=json&word_timestamps=false',
headers: {
...data.getHeaders(),
},
data: data,
};
try {
const response = await axios.request(config);
console.log(JSON.stringify(response.data));
} catch (error) {
console.log(error);
}
}
from whisper-asr-webservice.
Related Issues (20)
- Possibility to unload/reload model from VRAM/RAM after IDLE timeout HOT 3
- Update faster-whisper to 1.0.0 HOT 1
- Upgrade HOT 2
- add new model to use HOT 5
- Duration HOT 1
- how to run on gpu, m3 max mad
- Error: CERTIFICATE_VERIFY_FAILED HOT 3
- Could not load library libcudnn_cnn_infer.so.8.
- [Security-Critical] Vulnerabilities introduced via third party libs HOT 1
- Code bug
- number of WORKER_COUNT
- faster_whisper and openai_whisper have differently formatted responses
- Are downloaded files deleted after asr?
- [FEAT]: Diarization HOT 1
- Flush VRAM when idle
- [Important] HTTP Request Smuggling
- Integrating NB-Whisper
- Updating fast-whisper to 1.0.2 for distil-large-V3 support
- Unable to render this definition
- Error 500: named symbol not found HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from whisper-asr-webservice.