Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,14 @@
|
|
| 1 |
-
|
| 2 |
import gradio as gr
|
| 3 |
from whisper import generate
|
| 4 |
from AinaTheme import theme
|
| 5 |
|
| 6 |
-
MODEL_NAME = "
|
| 7 |
|
| 8 |
-
def transcribe(inputs
|
| 9 |
if inputs is None:
|
| 10 |
raise gr.Error("Cap fitxer d'脿udio introduit! Si us plau pengeu un fitxer "\
|
| 11 |
"o enregistreu un 脿udio abans d'enviar la vostra sol路licitud")
|
| 12 |
-
|
| 13 |
-
usev4 = model_version=="v0.4"
|
| 14 |
-
return generate(audio_path=inputs, use_v4=usev4)
|
| 15 |
|
| 16 |
|
| 17 |
description_string = "Transcripci贸 autom脿tica de micr貌fon o de fitxers d'脿udio.\n Aquest demostrador s'ha desenvolupat per"\
|
|
@@ -21,8 +18,7 @@ description_string = "Transcripci贸 autom脿tica de micr貌fon o de fitxers d'脿ud
|
|
| 21 |
|
| 22 |
def clear():
|
| 23 |
return (
|
| 24 |
-
None
|
| 25 |
-
"v0.3"
|
| 26 |
)
|
| 27 |
|
| 28 |
|
|
@@ -30,8 +26,8 @@ with gr.Blocks(theme=theme) as demo:
|
|
| 30 |
gr.Markdown(description_string)
|
| 31 |
with gr.Row():
|
| 32 |
with gr.Column(scale=1):
|
| 33 |
-
|
| 34 |
-
input = gr.Audio(sources=["upload"
|
| 35 |
|
| 36 |
with gr.Column(scale=1):
|
| 37 |
output = gr.Textbox(label="Output", lines=8)
|
|
@@ -41,10 +37,9 @@ with gr.Blocks(theme=theme) as demo:
|
|
| 41 |
submit_btn = gr.Button("Submit", variant="primary")
|
| 42 |
|
| 43 |
|
| 44 |
-
submit_btn.click(fn=transcribe, inputs=[input
|
| 45 |
-
clear_btn.click(fn=clear,inputs=[], outputs=[input
|
| 46 |
|
| 47 |
|
| 48 |
if __name__ == "__main__":
|
| 49 |
-
demo.launch()
|
| 50 |
-
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from whisper import generate
|
| 3 |
from AinaTheme import theme
|
| 4 |
|
| 5 |
+
MODEL_NAME = "projecte-aina/whisper-large-v3-ca-es-synth-cs"
|
| 6 |
|
| 7 |
+
def transcribe(inputs):
|
| 8 |
if inputs is None:
|
| 9 |
raise gr.Error("Cap fitxer d'脿udio introduit! Si us plau pengeu un fitxer "\
|
| 10 |
"o enregistreu un 脿udio abans d'enviar la vostra sol路licitud")
|
| 11 |
+
return generate(audio_path=inputs)
|
|
|
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
description_string = "Transcripci贸 autom脿tica de micr貌fon o de fitxers d'脿udio.\n Aquest demostrador s'ha desenvolupat per"\
|
|
|
|
| 18 |
|
| 19 |
def clear():
|
| 20 |
return (
|
| 21 |
+
None
|
|
|
|
| 22 |
)
|
| 23 |
|
| 24 |
|
|
|
|
| 26 |
gr.Markdown(description_string)
|
| 27 |
with gr.Row():
|
| 28 |
with gr.Column(scale=1):
|
| 29 |
+
#input = gr.Audio(sources=["upload", "microphone"], type="filepath", label="Audio")
|
| 30 |
+
input = gr.Audio(sources=["upload"], type="filepath", label="Audio")
|
| 31 |
|
| 32 |
with gr.Column(scale=1):
|
| 33 |
output = gr.Textbox(label="Output", lines=8)
|
|
|
|
| 37 |
submit_btn = gr.Button("Submit", variant="primary")
|
| 38 |
|
| 39 |
|
| 40 |
+
submit_btn.click(fn=transcribe, inputs=[input], outputs=[output])
|
| 41 |
+
clear_btn.click(fn=clear,inputs=[], outputs=[input], queue=False,)
|
| 42 |
|
| 43 |
|
| 44 |
if __name__ == "__main__":
|
| 45 |
+
demo.launch()
|
|
|