From bd9150fbcc435336542799f1da330f3052693394 Mon Sep 17 00:00:00 2001 From: Moritz Date: Fri, 16 Aug 2024 11:53:33 +0200 Subject: [PATCH] add more context and set default language=de --- whisper.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/whisper.py b/whisper.py index 46838b9..9bb23a5 100644 --- a/whisper.py +++ b/whisper.py @@ -16,13 +16,14 @@ def audio_callback_closure(client: AsyncClient): #with open("/tmp/audiofile",'bw') as file: # file.write(audio.body) print("Transcribe audio") - response = requests.post('http://127.0.0.1:9000/asr?encode=true&task=transcribe&word_timestamps=false&output=txt', files=files) + response = requests.post('http://127.0.0.1:9000/asr?encode=true&language=de&task=transcribe&word_timestamps=false&output=txt', files=files) print("Finished transcribing") room_id = room.room_id + body = f"{room.user_name(event.sender)}: {event.body} \n{response.content.decode()}" await client.room_send( room_id=room_id, message_type="m.room.message", - content={"msgtype": "m.text", "body": response.content.decode()}, + content={"msgtype": "m.text", "body": body}, ) return audio_callback