Skip to content

Commit

Permalink
Restored transcription change to work fine and updated .gitignore.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sammybams committed Oct 12, 2024
1 parent 2a111e4 commit 245942a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ pyvenv.cfg
*__pycache__/
*.DS_Store
*.venv/
audio.wav
*.wav
10 changes: 7 additions & 3 deletions src/speech_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 245942a

Please sign in to comment.