Campfireman commited on
Commit
921236f
1 Parent(s): 4f21df2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -27
app.py CHANGED
@@ -97,34 +97,22 @@ def transcribe2(audio):
97
  text = pipe(audio)["text"]
98
  return text
99
 
100
- # iface = gr.Interface(
101
- # fn=transcribe,
102
- # inputs=gr.Textbox(label = "Enter the URL of the Youtube video clip here (without prefixes like http://):"),
103
- # outputs="text",
104
- # title="Whisper Small SE",
105
- # description="Video Swedish Transcriptior",
106
- # )
107
- with gr.Blocks() as demo:
108
- with gr.TabItem("Record from microphone"):
109
-
110
- record_file = gr.Audio(source="microphone", type="filepath",label="Record from microphone")
111
- record_button = gr.Button("Submit for recognition")
112
- record_outputs = "text"
113
- with gr.TabItem("Transcribe from Youtube URL"):
114
- url = gr.Textbox(label = "Enter the URL of the Youtube video clip here (without prefixes like http://):"),
115
- youtube_button = gr.Button("Submit for recognition")
116
- youtube_outputs = "text"
117
 
118
- record_button.click(
119
- fn=transcribe2,
120
- inputs=record_file,
121
- outputs=record_outputs,
122
- )
123
- youtube_button.click(
124
- fn=transcribe,
125
- inputs=url,
126
- outputs=youtube_outputs,
127
- )
128
 
 
129
 
130
  demo.launch()
 
97
  text = pipe(audio)["text"]
98
  return text
99
 
100
+ iface = gr.Interface(
101
+ fn=transcribe,
102
+ inputs=gr.Textbox(label = "Enter the URL of the Youtube video clip here (without prefixes like http://):"),
103
+ outputs="text",
104
+ title="Whisper Small SE",
105
+ description="Video Swedish Transcriptior",
106
+ )
 
 
 
 
 
 
 
 
 
 
107
 
108
+ iface2 = gr.Interface(
109
+ fn=transcribe2,
110
+ inputs=gr.Audio(source="microphone", type="filepath"),
111
+ outputs="text",
112
+ title="Whisper Small Swedish",
113
+ description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
114
+ )
 
 
 
115
 
116
+ demo = gr.TabbedInterface([iface, iface2],
117
 
118
  demo.launch()