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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -15,16 +15,14 @@ def speech_to_text(audio):
15
  return "No audio file uploaded."
16
 
17
  try:
18
- # Open the audio file
19
- with open(audio, "rb") as audio_file:
20
- # Transcribe the audio to text using OpenAI's Whisper API
21
- response = openai.Audio.transcriptions.create(
22
- model="whisper-1", # Use the appropriate model for transcription
23
- file=audio_file,
24
- language="ta" # Specify the language as Tamil
25
- )
26
- text = response['text']
27
- return text
28
  except Exception as e:
29
  return f"Error during transcription: {str(e)}"
30
 
 
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:
27
  return f"Error during transcription: {str(e)}"
28