Files
church-translate/app/_probe-book.mjs
christianandClaude Opus 5 c9eef0672c Church Translate, as it runs at the campuses
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>
2026-09-23 15:41:21 -04:00

33 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 PHRASINGS=[
'Open up to the book of John.',
'Open to the book of John.',
'Turn to the book of John.',
'Turn with me to the book of John.',
'Go to the book of John.',
'Open your Bibles to the book of John.',
'The book of John chapter three.',
'In the book of Romans Paul writes this.',
'Read the book of Genesis with me.',
'This is a test of the names Jacob, Peter, John.',
'Jacob, Peter and John were there.',
'The names are Jacob, Peter and John.'
];
console.log('=== SPANISH: which phrasings get "libro" and which get "obra"? ===');
for (const t of PHRASINGS) {
const o=await pipe(t,{src_lang:'eng_Latn',tgt_lang:'spa_Latn'});
const s=(Array.isArray(o)?o[0]:o).translation_text.trim();
const flag=/\bobra/i.test(s)?' <-- OBRA (wrong)':(/\blibro/i.test(s)?' libro OK':'');
console.log(' '+t+'\n '+s+flag);
}
console.log('\n=== "the book of X" across the served languages ===');
for (const lang of ['spa_Latn','por_Latn','fra_Latn','zho_Hans','kor_Hang','vie_Latn','hat_Latn','arb_Arab','hin_Deva']) {
const o=await pipe('Open up to the book of John.',{src_lang:'eng_Latn',tgt_lang:lang});
console.log(' '+lang+' '+(Array.isArray(o)?o[0]:o).translation_text.trim());
}