WeLe Agentic AI with Docker deployment
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
/* Does auto mode now route Tamil to Tamil instead of silently using English? */
|
||||
import { synthesize, transcribe } from '../src/speech/index.js';
|
||||
|
||||
const resample = (a, from, to) => {
|
||||
const r = from / to, out = new Float32Array(Math.floor(a.length / r));
|
||||
for (let i = 0; i < out.length; i++) { const p = i * r, k = Math.floor(p); out[i] = a[k] + (a[Math.min(k + 1, a.length - 1)] - a[k]) * (p - k); }
|
||||
return out;
|
||||
};
|
||||
|
||||
for (const [lang, text] of [
|
||||
['ta', 'மூவாயிரம் நானூற்று இருபத்தேழு புதிய லீட்கள் உள்ளன.'],
|
||||
['en', 'How many new leads did we receive today?'],
|
||||
]) {
|
||||
const spoken = await synthesize(text, lang);
|
||||
const audio = resample(spoken.audio, spoken.sampling_rate, 16000);
|
||||
const r = await transcribe(audio, 'auto', 'ta');
|
||||
const ok = r.lang === lang ? 'PASS' : 'FAIL';
|
||||
console.log(`${ok} spoke ${lang} → routed ${r.lang} (detected ${r.detected} @ ${r.confidence}) ${r.ms}ms`);
|
||||
console.log(` ${JSON.stringify(r.text.slice(0, 80))}`);
|
||||
}
|
||||
process.exit(0);
|
||||
Reference in New Issue
Block a user