kozak-vaclav commited on
Commit
c2e5dee
1 Parent(s): 2e477e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -6
app.py CHANGED
@@ -62,14 +62,27 @@ def transcribe(audio_path):
62
 
63
  return transcription[0]
64
 
65
- # Create Gradio interface
66
- iface = gr.Interface(
 
 
 
 
 
 
 
67
  fn=transcribe,
68
- inputs=gr.inputs.Audio(source="microphone", type="filepath"),
69
- outputs="text",
70
- title="Kobraspeech RNN ASR demo (cs)",
71
- description="Upload an audio file or record your voice to get the transcription."
72
  )
73
 
 
 
 
 
 
 
 
 
74
  if __name__ == "__main__":
75
  iface.launch()
 
62
 
63
  return transcription[0]
64
 
65
+ demo = gr.Blocks()
66
+
67
+ mic_transcribe = gr.Interface(
68
+ fn=transcribe,
69
+ inputs=gr.Audio(sources="microphone", type="filepath"),
70
+ outputs=gr.outputs.Textbox(),
71
+ )
72
+
73
+ file_transcribe = gr.Interface(
74
  fn=transcribe,
75
+ inputs=gr.Audio(sources="upload", type="filepath"),
76
+ outputs=gr.outputs.Textbox(),
 
 
77
  )
78
 
79
+ with demo:
80
+ gr.TabbedInterface(
81
+ [mic_transcribe, file_transcribe],
82
+ ["Transcribe Microphone", "Transcribe Audio File"],
83
+ )
84
+
85
+ demo.launch(debug=True)
86
+
87
  if __name__ == "__main__":
88
  iface.launch()