TRANSCRIBE
=============================

Speech to text that runs entirely in the browser. Audio never leaves the device.

WHAT'S IN THIS FOLDER
---------------------
transcribe.html                         The whole tool (the AI library is built into the page)
engine/ort-wasm-simd-threaded.jsep.wasm The engine that runs the model (about 21 MB)
models/Xenova/whisper-base/             EMPTY: put the model files here (see step 1)


STEP 1: GET THE MODEL FILES (one time, about 80 MB)

Base is now the default model (more accurate than Tiny).
---------------------------------------------------
Click each link below; the browser downloads the real file directly.
Do NOT right-click a file name on the Hugging Face page and "Save link as".
That saves the web page that displays the file, not the file itself.

https://huggingface.co/Xenova/whisper-base/resolve/main/config.json?download=true
https://huggingface.co/Xenova/whisper-base/resolve/main/generation_config.json?download=true
https://huggingface.co/Xenova/whisper-base/resolve/main/preprocessor_config.json?download=true
https://huggingface.co/Xenova/whisper-base/resolve/main/tokenizer.json?download=true
https://huggingface.co/Xenova/whisper-base/resolve/main/tokenizer_config.json?download=true
https://huggingface.co/Xenova/whisper-base/resolve/main/onnx/encoder_model_quantized.onnx?download=true
https://huggingface.co/Xenova/whisper-base/resolve/main/onnx/decoder_model_merged_quantized.onnx?download=true

Roughly the right sizes:
  config.json                          about 2 KB
  generation_config.json               about 4 KB
  preprocessor_config.json             under 1 KB
  tokenizer.json                       about 2.4 MB
  tokenizer_config.json                about 280 KB
  encoder_model_quantized.onnx         about 23 MB
  decoder_model_merged_quantized.onnx  about 54 MB

The page checks every file when you pick the folder and marks any that are
web pages or damaged downloads with a red ✗.

WHERE TO PUT THEM
For the USB, any layout works. The page finds files by name. Simplest:
put all 8 files (7 model files + the engine .wasm) in ONE folder.
Required for iPhone/iPad, where you must use "select files".

For the SERVER (the "Download" tab), use this layout:
  models/Xenova/whisper-base/            the 5 .json files
  models/Xenova/whisper-base/onnx/       the 2 .onnx files
  engine/                                ort-wasm-simd-threaded.jsep.wasm

Picking: "Choose the folder" reads all subfolders in one go.
"Select files" can be used several times. Each pick adds to the
list. "Start over" clears it.

Faster but less accurate: the same 7 links with "whisper-base" changed to
"whisper-tiny" (about 40 MB), saved into models/Xenova/whisper-tiny/.
Tiny and Base files have the SAME names, so keep only ONE model in the
folder you pick for USB use, or pick the files by hand.


TEST A: FROM THE USB (no internet)
----------------------------------
1. Copy the whole Transcribe folder to the USB.
2. Double-click transcribe.html.
3. Click the "From a folder / USB" tab, then "Choose the folder", and pick the Transcribe folder.
   (On iPhone/iPad, choose "Select files" and pick the 8 files instead.
   iOS can't pick whole folders.)
4. A checklist shows whether all 8 files were found. Click "Load from folder".
5. Choose an audio file (or Record), then click Transcribe.
You can turn Wi-Fi off before step 2 to prove it works offline.


TEST B: ON YOUR SERVER
----------------------
Upload the whole folder (e.g. to /studio/transcribe/). Then the "Download" tab
uses the engine and model files from YOUR server, so no third-party requests are made.
If the models folder is missing on the server, it falls back to downloading
from Hugging Face. The browser keeps a copy after the first load.

TEST C: DOWNLOAD AUTOMATICALLY FROM A LOCAL FILE
------------------------------------------------
Opening transcribe.html from disk and using the "Download" tab fetches
the engine from jsDelivr and the model from Hugging Face. This needs internet.


WHAT TO NOTE WHILE TESTING
--------------------------
- The "Speed (× real time)" figure: 6× means 1 minute of audio takes about 10 seconds.
- "Test details for this browser" at the bottom: paste it into your notes for each device.
- Recording from a USB file may be blocked by some browsers (fine on the server).


KNOWN LIMITS OF THIS PROOF OF CONCEPT
-------------------------------------
- Long recordings are done 30 seconds at a time. Each section starts where the
  last complete sentence ended, so words aren't dropped or doubled at the joins.
- If a section gets stuck repeating itself, it is redone automatically (up to
  2 more tries). Anything still repeated 4+ times in a row is reduced to one
  copy and marked with a warning sign so you can check that part of the audio.
  Lines repeated 2-3 times (like drills) are kept as spoken.
- Tiny still makes small mistakes ("as" for "ask"). Small (about 250 MB) is more
  accurate again but much slower.
- Single thread only. The server version could get roughly 2–4× faster with the
  right security headers (COOP/COEP), and later with the graphics card (WebGPU).
- Tested here: Chrome on Linux, from file:// with ALL network blocked (zero requests)
  and from a local web server. Not yet tested: Firefox, Safari, Edge, iPhone/iPad.
