Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,35 +1,39 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
)
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
1 |
import gradio as gr
|
2 |
+
import whisper
|
3 |
|
4 |
+
# funci贸n para transcribir el audio
|
5 |
+
def whisper_transcript(model_size, audio_file):
|
6 |
+
source = audio_file
|
7 |
+
loaded_model = whisper.load_model(model_size)
|
8 |
+
transcript = loaded_model.transcribe(source, language="english")
|
9 |
+
return transcript["text"]
|
10 |
|
11 |
+
# interfaz gradio
|
12 |
+
gradio_ui = gr.Interface(
|
13 |
+
fn=whisper_transcript,
|
14 |
+
theme="Nymbo/Nymbo_Theme",
|
15 |
+
title="Transcribir audios en ingl茅s a texto",
|
16 |
+
description="**C贸mo usar**: Elegir uno de los 4 modelos, subir un audio o grabarlo y clicar el bot贸n de Submit.",
|
17 |
+
article="**Nota**: Exclusivo para audios en ingl茅s.",
|
18 |
+
inputs=[
|
19 |
+
gr.Dropdown(
|
20 |
+
label="Select Model",
|
21 |
+
choices=[
|
22 |
+
"tiny.en",
|
23 |
+
"base.en",
|
24 |
+
"small.en",
|
25 |
+
"medium.en",
|
26 |
+
],
|
27 |
+
value="base",
|
28 |
+
),
|
29 |
+
gr.Audio(label="Upload Audio File", sources=["upload", "microphone"], type="filepath"),
|
30 |
+
],
|
31 |
+
outputs=gr.Textbox(label="Whisper Transcript"),
|
32 |
)
|
33 |
|
34 |
+
# A帽adir caja de texto adicional
|
35 |
+
with gr.Blocks() as app:
|
36 |
+
gradio_ui.render() # Renderiza tu interfaz principal
|
37 |
+
gr.Textbox(label="Caja de texto adicional (sin funci贸n)") # Caja de texto extra
|
38 |
+
|
39 |
+
app.queue().launch()
|