Initial commit: Doctor-Patient clinical transcription and structured summary pipeline
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const dotenv = require('dotenv');
|
||||
|
||||
dotenv.config({ path: path.join(__dirname, '.env') });
|
||||
const SARVAM_API_KEY = process.env.SARVAM_API_KEY;
|
||||
|
||||
async function test() {
|
||||
const filePath = path.join(__dirname, 'backend', 'test.wav');
|
||||
if (!fs.existsSync(filePath)) {
|
||||
console.error("test.wav not found");
|
||||
return;
|
||||
}
|
||||
const audioBuffer = fs.readFileSync(filePath);
|
||||
const formData = new FormData();
|
||||
formData.append('file', new Blob([audioBuffer], { type: 'audio/wav' }), 'test.wav');
|
||||
formData.append('model', 'saaras:v4');
|
||||
formData.append('mode', 'codemix');
|
||||
formData.append('with_timestamps', 'true');
|
||||
formData.append('with_diarization', 'true');
|
||||
|
||||
try {
|
||||
const resp = await fetch('https://api.sarvam.ai/speech-to-text', {
|
||||
method: 'POST',
|
||||
headers: { 'api-subscription-key': SARVAM_API_KEY },
|
||||
body: formData
|
||||
});
|
||||
console.log(resp.status);
|
||||
const data = await resp.text();
|
||||
console.log(data);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
test();
|
||||
Reference in New Issue
Block a user