21 lines
772 B
JavaScript
21 lines
772 B
JavaScript
const fs = require('fs');
|
|
const dotenv = require('dotenv');
|
|
|
|
dotenv.config();
|
|
|
|
async function test() {
|
|
const formData = new FormData();
|
|
formData.append('model', 'saaras:v4');
|
|
formData.append('with_diarization', 'true');
|
|
|
|
// Need a valid audio file to upload
|
|
const buf = fs.readFileSync('./backend/test.wav'); // We need a real wav or we can create a valid one
|
|
formData.append('file', new Blob([buf], { type: 'audio/wav' }), 'test.wav');
|
|
|
|
// Let's try POST to https://api.sarvam.ai/speech-to-text/batch or something?
|
|
// Wait, the python sdk uses `client.speech_to_text_job.create_job`
|
|
// The url is probably something like https://api.sarvam.ai/v1/speech-to-text/jobs or /v1/stt/batch
|
|
// Let's search npm for sarvamai or check the sdk source.
|
|
}
|
|
test();
|