zanemotiwala commited on
Commit
ccee400
1 Parent(s): 9854ee3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -1,17 +1,14 @@
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)}")
@@ -29,4 +26,3 @@ with gr.Blocks() as demo:
29
  transcribe_button.click(transcribe_speech, inputs=mic, outputs=transcription)
30
 
31
  demo.launch(share=True)
32
-
 
1
  import gradio as gr
2
  import logging
3
 
4
+ # Adjusted function assuming 'asr' expects a file path as input
5
+ def transcribe_speech(audio_file_path):
6
+ if not audio_file_path:
 
 
 
7
  logging.error("No audio file provided.")
8
  return "No audio found, please retry."
9
  try:
10
+ logging.info(f"Processing file: {audio_file_path}")
11
+ output = asr(audio_file_path) # Assuming `asr` directly takes a file path
12
  return output["text"]
13
  except Exception as e:
14
  logging.error(f"Error during transcription: {str(e)}")
 
26
  transcribe_button.click(transcribe_speech, inputs=mic, outputs=transcription)
27
 
28
  demo.launch(share=True)