Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,9 @@ model = whisper.load_model("small")
|
|
10 |
wikipedia.set_lang("en")
|
11 |
passage = wikipedia.summary("pirate code", sentences=2)
|
12 |
|
|
|
|
|
|
|
13 |
|
14 |
|
15 |
def inference(audio):
|
@@ -203,7 +206,12 @@ with block:
|
|
203 |
)
|
204 |
|
205 |
btn = gr.Button("Transcribe")
|
|
|
|
|
206 |
text = gr.Textbox(show_label=False, elem_id="result-textarea")
|
|
|
|
|
|
|
207 |
with gr.Group(elem_id="share-btn-container"):
|
208 |
community_icon = gr.HTML(community_icon_html, visible=False)
|
209 |
loading_icon = gr.HTML(loading_icon_html, visible=False)
|
@@ -213,6 +221,7 @@ with block:
|
|
213 |
|
214 |
|
215 |
btn.click(inference, inputs=[audio], outputs=[text, community_icon, loading_icon, share_button])
|
|
|
216 |
share_button.click(None, [], [], _js=share_js)
|
217 |
|
218 |
gr.HTML('''
|
|
|
10 |
wikipedia.set_lang("en")
|
11 |
passage = wikipedia.summary("pirate code", sentences=2)
|
12 |
|
13 |
+
def update_passage(passage_name):
|
14 |
+
passage = wikipedia.summary("pirate code", sentences=2)
|
15 |
+
return passage, ""
|
16 |
|
17 |
|
18 |
def inference(audio):
|
|
|
206 |
)
|
207 |
|
208 |
btn = gr.Button("Transcribe")
|
209 |
+
|
210 |
+
|
211 |
text = gr.Textbox(show_label=False, elem_id="result-textarea")
|
212 |
+
|
213 |
+
btn2 = gr.Button("Fetch another article")
|
214 |
+
passage_name = gr.Textbox(label="Wikipedia article name", placeholder="The pirate code")
|
215 |
with gr.Group(elem_id="share-btn-container"):
|
216 |
community_icon = gr.HTML(community_icon_html, visible=False)
|
217 |
loading_icon = gr.HTML(loading_icon_html, visible=False)
|
|
|
221 |
|
222 |
|
223 |
btn.click(inference, inputs=[audio], outputs=[text, community_icon, loading_icon, share_button])
|
224 |
+
btn2.click(update_passage, inputs=[passage_name], outputs=[passage, text]
|
225 |
share_button.click(None, [], [], _js=share_js)
|
226 |
|
227 |
gr.HTML('''
|