add more context and set default language=de

This commit is contained in:
Moritz 2024-08-16 11:53:33 +02:00
parent 9f7b08e278
commit bd9150fbcc

View file

@ -16,13 +16,14 @@ def audio_callback_closure(client: AsyncClient):
#with open("/tmp/audiofile",'bw') as file: #with open("/tmp/audiofile",'bw') as file:
# file.write(audio.body) # file.write(audio.body)
print("Transcribe audio") 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") print("Finished transcribing")
room_id = room.room_id room_id = room.room_id
body = f"{room.user_name(event.sender)}: {event.body} \n{response.content.decode()}"
await client.room_send( await client.room_send(
room_id=room_id, room_id=room_id,
message_type="m.room.message", message_type="m.room.message",
content={"msgtype": "m.text", "body": response.content.decode()}, content={"msgtype": "m.text", "body": body},
) )
return audio_callback return audio_callback