From 245942a0c612c7699f5e643cfcbe9e5fc567c08a Mon Sep 17 00:00:00 2001 From: Sammybams Date: Sat, 12 Oct 2024 23:21:27 +0100 Subject: [PATCH] Restored transcription change to work fine and updated .gitignore. --- .gitignore | 2 +- src/speech_io.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 96228b7..fb76e8d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,4 @@ pyvenv.cfg *__pycache__/ *.DS_Store *.venv/ -audio.wav \ No newline at end of file +*.wav \ No newline at end of file diff --git a/src/speech_io.py b/src/speech_io.py index 411cafb..4351710 100644 --- a/src/speech_io.py +++ b/src/speech_io.py @@ -37,15 +37,19 @@ def transcribe_audio(audio_file_path): # Prepare the request data properly as JSON data = { - 'locales': ['en-US'], - 'profanityFilterMode': 'Masked' + 'definition': ''' + { + "locales": ["en-US"], + "profanityFilterMode": "Masked" + } + ''' } try: with open(audio_file_path, 'rb') as audio_file: files = {'audio': audio_file} # Make the POST request to the API - response = requests.post(STT_URL, headers=headers, files=files, json=data) + response = requests.post(STT_URL, headers=headers, files=files, data=data) response.raise_for_status() # Raise an exception for bad status codes result = response.json()