changed description, added ko-fi link, removed deprecated gradio parameters
Browse files
app.py
CHANGED
@@ -22,12 +22,12 @@ def transcribe(microphone, file_upload):
|
|
22 |
warn_output = ""
|
23 |
if (microphone is not None) and (file_upload is not None):
|
24 |
warn_output = (
|
25 |
-
"
|
26 |
-
"
|
27 |
)
|
28 |
|
29 |
elif (microphone is None) and (file_upload is None):
|
30 |
-
return "
|
31 |
|
32 |
file = microphone if microphone is not None else file_upload
|
33 |
|
@@ -58,40 +58,44 @@ def yt_transcribe(yt_url):
|
|
58 |
|
59 |
demo = gr.Blocks()
|
60 |
|
|
|
|
|
|
|
61 |
mf_transcribe = gr.Interface(
|
62 |
fn=transcribe,
|
63 |
inputs=[
|
64 |
-
gr.inputs.Audio(source="microphone", type="filepath"
|
65 |
-
gr.inputs.Audio(source="upload", type="filepath"
|
66 |
],
|
67 |
-
outputs=
|
68 |
-
|
69 |
-
theme="huggingface",
|
70 |
-
title="Fine-Tuned Whisper Demo: Transcribe Italian Audio 🇮🇹",
|
71 |
description=(
|
72 |
-
"
|
73 |
-
|
74 |
-
"
|
|
|
75 |
),
|
76 |
allow_flagging="never",
|
77 |
)
|
78 |
|
|
|
|
|
|
|
79 |
yt_transcribe = gr.Interface(
|
80 |
fn=yt_transcribe,
|
81 |
-
inputs=[gr.inputs.Textbox(lines=1, placeholder="
|
82 |
-
outputs=["html",
|
83 |
-
|
84 |
-
theme="huggingface",
|
85 |
-
title="Fine-Tuned Whisper Demo: Transcribe Italian YouTube video 🇮🇹",
|
86 |
description=(
|
87 |
-
"
|
88 |
-
|
89 |
-
"
|
|
|
90 |
),
|
91 |
allow_flagging="never",
|
92 |
)
|
93 |
|
94 |
with demo:
|
95 |
-
gr.TabbedInterface([mf_transcribe, yt_transcribe], ["
|
96 |
|
97 |
demo.launch(enable_queue=True)
|
|
|
22 |
warn_output = ""
|
23 |
if (microphone is not None) and (file_upload is not None):
|
24 |
warn_output = (
|
25 |
+
"ATTENZIONE: Hai caricato un file audio e anche registrato col microfono. "
|
26 |
+
"Verrà trascritta la registrazione dal microfono, mentre il file audio verrà cancellato. \n"
|
27 |
)
|
28 |
|
29 |
elif (microphone is None) and (file_upload is None):
|
30 |
+
return "ERRORE: Devi caricare un file audio oppure registrare con il microfono."
|
31 |
|
32 |
file = microphone if microphone is not None else file_upload
|
33 |
|
|
|
58 |
|
59 |
demo = gr.Blocks()
|
60 |
|
61 |
+
text_output = gr.Textbox(show_label=True)
|
62 |
+
text_output.style(show_copy_button=True)
|
63 |
+
|
64 |
mf_transcribe = gr.Interface(
|
65 |
fn=transcribe,
|
66 |
inputs=[
|
67 |
+
gr.inputs.Audio(source="microphone", type="filepath"),
|
68 |
+
gr.inputs.Audio(source="upload", type="filepath"),
|
69 |
],
|
70 |
+
outputs=text_output,
|
71 |
+
title="Trascrivi Audio",
|
|
|
|
|
72 |
description=(
|
73 |
+
"Trascrivi l'input da microfono o file audio con un click!\n"
|
74 |
+
"L'inference su scheda grafica riduce i tempi di circa 10 volte, "
|
75 |
+
"per coprire le spese puoi offrirmi un caffe ☕️[qui](https://ko-fi.com/marcobuiani)"
|
76 |
+
"Questa demo usa una versione di Whisper ottimizzata per l'Italiano da " f"[EdoAbati](https://huggingface.co/{MODEL_NAME})"
|
77 |
),
|
78 |
allow_flagging="never",
|
79 |
)
|
80 |
|
81 |
+
text_output_yt = gr.Textbox(show_label=True)
|
82 |
+
text_output_yt.style(show_copy_button=True)
|
83 |
+
|
84 |
yt_transcribe = gr.Interface(
|
85 |
fn=yt_transcribe,
|
86 |
+
inputs=[gr.inputs.Textbox(lines=1, placeholder="Incolla qui il link di un video YouTube", label="YouTube link")],
|
87 |
+
outputs=["html", text_output_yt],
|
88 |
+
title="Trascrivi Video YouTube",
|
|
|
|
|
89 |
description=(
|
90 |
+
"Trascrivi un video YouTube dal link con un click!\n"
|
91 |
+
"L'inference su scheda grafica riduce i tempi di circa 10 volte, "
|
92 |
+
"per coprire le spese puoi offrirmi un caffe ☕️[qui](https://ko-fi.com/marcobuiani)"
|
93 |
+
"Questa demo usa una versione di Whisper ottimizzata per l'Italiano da " f"[EdoAbati](https://huggingface.co/{MODEL_NAME})"
|
94 |
),
|
95 |
allow_flagging="never",
|
96 |
)
|
97 |
|
98 |
with demo:
|
99 |
+
gr.TabbedInterface([mf_transcribe, yt_transcribe], ["Trascrivi Audio", "Trascrivi YouTube"])
|
100 |
|
101 |
demo.launch(enable_queue=True)
|