Live sermon translation into 100+ languages, running entirely on one Mac per campus: audio in, voice detection, Whisper on the GPU, NLLB-200 in its own process, and a built-in web server the congregation reads from on their phones. No audio leaves the building. This is the source only. What used to sit beside it — 14 GB of speech and translation models, 8 GB of voice bundles, 6 GB of natural voices, the Electron caches, and the app data holding the operator PIN and every service transcript — is machine state and downloaded assets, and stays in the NAS backup where it belongs. The vendored node, cloudflared and Windows ffmpeg binaries are out too (533 MB, re-fetched for packaging); the browser-side runtime beside them is kept, so a checkout still serves the congregation page. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
44 lines
1.5 KiB
JavaScript
44 lines
1.5 KiB
JavaScript
import { pipeline, env } from '@huggingface/transformers';
|
|
import os from 'os'; import path from 'path';
|
|
env.allowLocalModels=false;
|
|
env.cacheDir=path.join(os.homedir(),'Library/Application Support/Church Translate Models');
|
|
const pipe=await pipeline('translation','Xenova/nllb-200-distilled-600M',{dtype:'fp32'});
|
|
const say=async(t,l='spa_Latn')=>{const o=await pipe(t,{src_lang:'eng_Latn',tgt_lang:l});return (Array.isArray(o)?o[0]:o).translation_text.trim();};
|
|
|
|
/* Real preaching idioms. The question for each is not "is it good Spanish" but
|
|
"did the MEANING survive" — a fluent wrong answer is the dangerous case. */
|
|
const IDIOMS=[
|
|
'Open up to the book of John.',
|
|
'Open up to John chapter three.',
|
|
'Open up your Bibles.',
|
|
'Turn with me to John chapter three.',
|
|
'Look at verse four with me.',
|
|
'Drop down to verse ten.',
|
|
'Back up to verse one.',
|
|
'Come on, somebody.',
|
|
'Give God a hand of praise.',
|
|
'Put a hand on your neighbor.',
|
|
'Say it with me.',
|
|
'Can somebody say amen.',
|
|
'I want you to catch this.',
|
|
'Watch this.',
|
|
'Are you tracking with me.',
|
|
'That will preach.',
|
|
'He is a good good Father.',
|
|
'God showed up.',
|
|
'The enemy is defeated.',
|
|
'Walk it out.',
|
|
'Let that sink in.',
|
|
'Write this down.',
|
|
'Circle that in your Bible.',
|
|
'Underline that word.',
|
|
'We are going to camp out here for a minute.',
|
|
'Let me unpack that for you.',
|
|
'Turn the page.',
|
|
'Stand to your feet.',
|
|
'Bow your heads with me.'
|
|
];
|
|
console.log('idiom -> Spanish');
|
|
console.log('='.repeat(70));
|
|
for (const t of IDIOMS) console.log(' '+t+'\n '+await say(t));
|