Add web demo for AI Real-Time Translation Bridge - #82
Merged
Conversation
Browser-based demo of the translation engine — same Telnyx AI Inference API as the phone-call sample, but with a web UI instead of telephony. - demo/app.py: Flask backend, /translate calls Telnyx AI Inference (model: zai-org/GLM-5.1-FP8, Telnyx-hosted, multilingual) - demo/templates/index.html: dual chat panels + live pipeline visualization (Speech -> STT -> AI Translate -> TTS), vanilla JS - demo/requirements.txt: Flask, requests, python-dotenv - demo/.env.example: needs TELNYX_API_KEY only - demo/README.md: run instructions + mapping to phone-call sample Supports 12 languages. No phone numbers, no webhooks, no Call Control setup needed — just an API key and a browser.
CodeQL flagged two 'Information exposure through an exception' alerts on the error handlers in /translate. The raw exception message was interpolated into the JSON response, which could leak stack traces or internal details to the browser. Fix: log the full error server-side via print(), return a generic message to the client. Also update demo/README.md to reflect the correct default model (zai-org/GLM-5.1-FP8, not moonshotai/Kimi-K2.6).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
A browser-based demo of the translation engine from the AI Real-Time Translation Bridge example. Same Telnyx AI Inference API, same model, same prompt — just a web UI instead of telephony.
Why
The phone-call sample requires a purchased number, a Call Control application, webhook tunneling (ngrok), and two test phones to see it work. That's a lot of setup before you can verify the translation engine actually works. This web demo lets you see the same translation live in a browser with just an API key — useful for demos, videos, and quick verification.
What's in the PR
demo/app.py/translatecalls Telnyx AI Inference (zai-org/GLM-5.1-FP8)demo/templates/index.htmldemo/requirements.txtdemo/.env.exampleTELNYX_API_KEYdemo/README.mdHow it maps to the phone-call sample
/translateendpointtranslate()→ AI InferenceThe translation engine is identical — same endpoint, same model, same system prompt. The demo just replaces telephony I/O with a web UI.
Languages supported
English, Spanish, French, German, Italian, Portuguese, Hindi, Arabic, Chinese, Japanese, Korean, Russian.
Run locally
Get an API key at https://portal.telnyx.com/#/app/ai/keys.
Verification
Tested all three demo turns locally via Playwright:
Notes
app.pyat the example root) is unchanged. This PR only adds ademo/subdirectory.zai-org/GLM-5.1-FP8(Telnyx-hosted, multilingual). Configurable viaAI_MODELin.env..envis gitignored (confirmed:git check-ignorecoversdemo/.env).