HTTP API and Docker

The repository ships a FastAPI server with a web demo. Run the Docker image, or uvicorn server:app from a clone after pip install ".[app]".

$ docker run -p 8000:8000 openpronounce
$ curl -F file=@answer.wav -F expected_text="Hello, I am a good designer" -F lang=en http://localhost:8000/pronunciation
$ curl -F file=@talk.wav http://localhost:8000/free

Endpoints

EndpointForm fieldsReturns
POST /pronunciationfile, expected_text, lang (default en)The full read-speech result
POST /freefile, langThe free-speech result
POST /speech2textfile, lang{"transcript": ...}
POST /phonemestext, langThe expected sounds of a text
POST /ttstext, langA reference reading, 16 kHz wav
GET /languagesThe languages available
GET /healthLiveness, for your orchestrator
GET /docsInteractive documentation

From a browser

const form = new FormData();
form.append("file", recordingBlob, "answer.webm");   // from MediaRecorder
form.append("expected_text", "Hello, I am a good designer");
const result = await (await fetch("/pronunciation", { method: "POST", body: form })).json();
if (!result.reliable) showRetry(result.reasons);

In production

  • The image downloads the models at build time: deploy it where the network is closed.
  • Count about 4 GB of memory per instance, and scale on the number of recordings analysed at the same time.
  • Dockerfile.gpu builds the same server for an NVIDIA GPU.
  • The server has no authentication of its own. Put it behind your gateway.