anuragshas commited on
Commit
23ab019
Β·
1 Parent(s): 149b9d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -28,8 +28,19 @@ def predict_and_ctc_lm_decode(input_file):
28
  return transcribed_text["text"]
29
 
30
 
 
 
 
 
 
 
 
 
 
 
 
31
  gr.Interface(
32
- predict_and_ctc_lm_decode,
33
  inputs=[
34
  gr.inputs.Audio(source="upload", type="filepath", optional=True),
35
  gr.inputs.Audio(source="microphone", type="filepath", optional=True),
 
28
  return transcribed_text["text"]
29
 
30
 
31
+ def speech_recognize(file_upload, file_mic):
32
+ if file_upload is not None:
33
+ file = file_upload
34
+ elif file_mic is not None:
35
+ file = file_mic
36
+ else:
37
+ return ""
38
+ text = predict_and_ctc_lm_decode(file)
39
+ return text
40
+
41
+
42
  gr.Interface(
43
+ speech_recognize,
44
  inputs=[
45
  gr.inputs.Audio(source="upload", type="filepath", optional=True),
46
  gr.inputs.Audio(source="microphone", type="filepath", optional=True),