From 1cea20a42d239bb463bf489dc71eae569e33460c Mon Sep 17 00:00:00 2001 From: Quentin Fuxa Date: Tue, 24 Dec 2024 19:36:20 +0100 Subject: [PATCH] /ws to /asr to distinguish protocol ws:// from endpoint --- README.md | 2 +- src/live_transcription.html | 4 ++-- whisper_fastapi_online_server.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0cc721b..b8850d6 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ This project reuses and extends code from the original Whisper Streaming reposit ### How the Live Interface Works - Once you **allow microphone access**, the page records small chunks of audio using the **MediaRecorder** API in **webm/opus** format. -- These chunks are sent over a **WebSocket** to the FastAPI endpoint at `/ws`. +- These chunks are sent over a **WebSocket** to the FastAPI endpoint at `/asr`. - The Python server decodes `.webm` chunks on the fly using **FFmpeg** and streams them into the **whisper streaming** implementation for transcription. - **Partial transcription** appears as soon as enough audio is processed. The “unvalidated” text is shown in **lighter or grey color** (i.e., an ‘aperçu’) to indicate it’s still buffered partial output. Once Whisper finalizes that segment, it’s displayed in normal text. - You can watch the transcription update in near real time, ideal for demos, prototyping, or quick debugging. diff --git a/src/live_transcription.html b/src/live_transcription.html index 2bad95b..33c767f 100644 --- a/src/live_transcription.html +++ b/src/live_transcription.html @@ -92,7 +92,7 @@
- +
@@ -105,7 +105,7 @@ websocket, recorder, chunkDuration = 1000, - websocketUrl = "ws://localhost:8000/ws"; + websocketUrl = "ws://localhost:8000/asr"; // Tracks whether the user voluntarily closed the WebSocket let userClosing = false; diff --git a/whisper_fastapi_online_server.py b/whisper_fastapi_online_server.py index 5b5472a..2b941f3 100644 --- a/whisper_fastapi_online_server.py +++ b/whisper_fastapi_online_server.py @@ -57,7 +57,7 @@ async def start_ffmpeg_decoder(): ) return process -@app.websocket("/ws") +@app.websocket("/asr") async def websocket_endpoint(websocket: WebSocket): await websocket.accept() print("WebSocket connection opened.")