Skip to content

Build a vocabulary app with MAI

Use Flask and browser JavaScript to add speech, voice answers, and memory images to a vocabulary list.

Set up your Codespace, then follow the steps below. Work in starter/. In each model lesson you paste the controls, write the MAI call from a short contract (a reference solution is folded underneath), check it, and try one experiment. checkpoints/ lets you catch up; solution/ is the finished app.

See the app in action App walkthrough: add a French word pair, hear both languages, record and match an answer, generate an image, and request a mnemonic.

Silent walkthrough with example model responses. Loops at a slower pace; close this panel to hide it.

Step What you build You write
00 — Open the app A page served by Flask. —
01 — Word list Word pairs saved in the browser. —
02 — Speech English and target-language playback. The /speak route
03 — Transcription Recording and recognized text. The /transcribe route
04 — Matching Feedback on the spoken answer. normalizeAnswer
05 — Images A generated visual cue for each word. The /image route

Next: add MAI-Thinking mnemonics.

Which models you use

Speech playback uses MAI-Voice-2-Flash; transcription uses MAI-Transcribe-2; images use MAI-Image-2.6-Flash; optional mnemonics use MAI-Thinking-1. Saving words and matching answers use JavaScript, not a model.

MAI-generated diagram. Full size · Prompts and revisions.

Speech reads your saved text; it does not translate it.

Explore the MAI family and compare costs.

Local setup · API and troubleshooting