/ws to /asr to distinguish protocol ws:// from endpoint

This commit is contained in:
Quentin Fuxa
2024-12-24 19:36:20 +01:00
parent 50bbd26517
commit 1cea20a42d
3 changed files with 4 additions and 4 deletions

View File

@@ -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 its still buffered partial output. Once Whisper finalizes that segment, its displayed in normal text.
- You can watch the transcription update in near real time, ideal for demos, prototyping, or quick debugging.

View File

@@ -92,7 +92,7 @@
</div>
<div>
<label for="websocketInput">WebSocket URL:</label>
<input id="websocketInput" type="text" value="ws://localhost:8000/ws" />
<input id="websocketInput" type="text" value="ws://localhost:8000/asr" />
</div>
</div>
</div>
@@ -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;

View File

@@ -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.")