subDesTagesMitExtraKaese 2 years ago
parent
commit
1a831797ce
3 changed files with 3 additions and 3 deletions
  1. 1 1
      Dockerfile
  2. 1 1
      main.py
  3. 1 1
      speech_recognition.py

+ 1 - 1
Dockerfile

@@ -18,7 +18,7 @@ FROM alpine
 WORKDIR /app/
 
 # Install dependencies
-RUN apk add ffmpeg py3-olm py3-matrix-nio py3-pip py3-pillow
+RUN apk add ffmpeg py3-olm py3-matrix-nio py3-pip py3-pillow gcompat
 
 ADD requirements.txt .
 

+ 1 - 1
main.py

@@ -39,7 +39,7 @@ async def on_audio_message(room, event):
     await bot.async_client.room_typing(room.machine_name, False)
     await bot.api.send_text_message(
       room_id=room.room_id,
-      message=f"Transcription of {response.filename}: {result['text']}",
+      message=f"Transcription of {response.filename}: {result}",
       msgtype="m.notice")
 
 if __name__ == "__main__":

+ 1 - 1
speech_recognition.py

@@ -10,7 +10,7 @@ def convert_audio(data: bytes) -> bytes:
     # Requires the ffmpeg CLI and `ffmpeg-python` package to be installed.
     out, _ = (
       ffmpeg.input("pipe:", threads=0)
-      .output("-", format="s16le", acodec="pcm_s16le", ac=1, ar=SAMPLE_RATE)
+      .output("-", format="wav", acodec="pcm_s16le", ac=1, ar=SAMPLE_RATE)
       .run(cmd="ffmpeg", capture_stdout=True, capture_stderr=True, input=data)
     )
   except ffmpeg.Error as e: