Live Khutbah Displayer

FastAPIWebSocketsGeminiEmbeddingsMunsit ASRStreamlit

Live Friday sermon display in Arabic, Urdu and English, matching the imam's speech to the official sermon text in near real time.

Featured image for Live Khutbah Displayer

Overview

Mosque screens needed to show the live Friday sermon in Arabic, Urdu and English. The client wanted a system light enough to later run on low-cost hardware and become a product. I built two parts: an Aligner that prepares the sermon text, and a Displayer that follows the imam live.

The Problem

Free speech-to-text translation was the obvious approach, but it failed. Whisper (small) and Vosk were not accurate enough for Arabic on light hardware. The key insight: the sermon text is issued in advance and is the same across mosques. So the problem became matching live speech to known text, not translating from scratch.

Technical Solution

System Architecture

  • •Aligner (Streamlit): Gemini splits the official sermon into sentence-level Arabic, Urdu and English pairs
  • •A person reviews the aligned pairs before they are used
  • •multilingual-e5-base (int8) embeddings for fast, CPU-only matching
  • •Displayer (FastAPI): live audio goes through custom noise reduction and gain, then Munsit ASR
  • •Each transcribed chunk is matched to the stored Arabic segments; a line is shown only above a confidence threshold
  • •Lightweight HTML display updated over WebSockets

Backend

FastAPI, WebSockets

Speech to text

Munsit API

Matching

multilingual-e5-base (int8)

Alignment

Gemini + human review

Live Khutbah Displayer architecture diagram

Results & Impact

3

languages shown together

2

parts: Aligner and live Displayer

CPU-only

text matching, no GPU needed

Lessons Learned

Change the problem, not the model

When speech-to-text alone failed on Arabic, matching against the known sermon text made the system reliable.

Thresholds are a trade-off

Too low shows wrong lines; too high makes the display stall.

Keep a human in the loop

A quick review of the aligned text catches mistakes before they reach a mosque screen.

Have a project in mind?

Book a quick discovery call, or send a message from the contact section on the home page.

Book a 15-Min Discovery CallOr send a message instead →

© 2026 Muhammad Saad. All rights reserved.