Spaces:
Runtime error
Runtime error
Commit
·
2f272be
1
Parent(s):
b05779c
create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
modelo = pipeline("automatic-speech-recognition", model = "facebook/wav2vec2-large-xlsr-53-spanish")
|
5 |
+
title = "Speech2Text"
|
6 |
+
description = "Record an audio and convert it to text"
|
7 |
+
|
8 |
+
def transcribe(audio):
|
9 |
+
text = modelo(audio)["text"]
|
10 |
+
return text
|
11 |
+
|
12 |
+
|
13 |
+
gr.Interface(
|
14 |
+
fn = transcribe,
|
15 |
+
inputs = [gr.Audio(source="microphone", type = "filepath")],
|
16 |
+
outputs = ["textbox"],
|
17 |
+
title = title,
|
18 |
+
description = description
|
19 |
+
).launch()
|