dindizz commited on
Commit
ae64426
·
verified ·
1 Parent(s): 0e8b210

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -15,12 +15,13 @@ def speech_to_text(audio):
15
  return "No audio file uploaded."
16
 
17
  try:
18
- # Transcribe the audio to text using OpenAI's Whisper API
19
- response = openai.Audio.transcribe(
20
- model="whisper-1", # Use the appropriate model for transcription
21
- file=open(audio, "rb"),
22
- language="ta" # Specify the language as Tamil
23
- )
 
24
  text = response['text']
25
  return text
26
  except Exception as e:
 
15
  return "No audio file uploaded."
16
 
17
  try:
18
+ # Transcribe the audio to text using OpenAI's Whisper API via the new method
19
+ with open(audio, "rb") as audio_file:
20
+ response = openai.Audio.transcribe(
21
+ model="whisper-1", # Use the appropriate model for transcription
22
+ file=audio_file,
23
+ language="ta" # Specify the language as Tamil
24
+ )
25
  text = response['text']
26
  return text
27
  except Exception as e: