Spaces:
Sleeping
Sleeping
zanemotiwala
commited on
Commit
•
9854ee3
1
Parent(s):
4d6774a
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,23 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
def transcribe_speech(audio_file):
|
4 |
if audio_file is None:
|
|
|
5 |
return "No audio found, please retry."
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
with gr.Blocks() as demo:
|
11 |
with gr.Row():
|
|
|
1 |
import gradio as gr
|
2 |
+
import logging
|
3 |
+
|
4 |
+
# Assuming `asr` is defined somewhere and correctly implemented
|
5 |
+
# def asr(file_path):
|
6 |
+
# # Process the file and return {'text': 'transcription'}
|
7 |
|
8 |
def transcribe_speech(audio_file):
|
9 |
if audio_file is None:
|
10 |
+
logging.error("No audio file provided.")
|
11 |
return "No audio found, please retry."
|
12 |
+
try:
|
13 |
+
logging.info(f"Processing file: {audio_file.name}")
|
14 |
+
output = asr(audio_file.name)
|
15 |
+
return output["text"]
|
16 |
+
except Exception as e:
|
17 |
+
logging.error(f"Error during transcription: {str(e)}")
|
18 |
+
return f"Error processing the audio file: {str(e)}"
|
19 |
+
|
20 |
+
logging.basicConfig(level=logging.INFO)
|
21 |
|
22 |
with gr.Blocks() as demo:
|
23 |
with gr.Row():
|