Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,16 +15,14 @@ def speech_to_text(audio):
|
|
| 15 |
return "No audio file uploaded."
|
| 16 |
|
| 17 |
try:
|
| 18 |
-
#
|
| 19 |
-
|
| 20 |
-
#
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 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 |
|