Spaces:
Runtime error
Runtime error
GuillermoPuma
commited on
Commit
•
b5dcfd5
1
Parent(s):
35c0f2d
add files
Browse files- app.py +30 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from huggingsound import SpeechRecognitionModel
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
|
5 |
+
model = SpeechRecognitionModel("patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm")
|
6 |
+
|
7 |
+
|
8 |
+
def transcribe(audio, state=""):
|
9 |
+
transcriptions_es = model.transcribe([audio])[0]
|
10 |
+
# Algoritmo here
|
11 |
+
|
12 |
+
recomendacion = "definir variable"
|
13 |
+
return transcriptions_es['transcription'], recomendacion
|
14 |
+
|
15 |
+
inputs = gr.inputs.Audio(label="Dar click para escuchar tu voz", type="filepath", source="microphone")
|
16 |
+
output1 = gr.outputs.Textbox(label="Asi se ve tu código")
|
17 |
+
output2 = gr.outputs.Textbox(label="Tal vez quisiste decir:")
|
18 |
+
|
19 |
+
title = "Expresate con voz"
|
20 |
+
description = "Aplicación que ayuda a programar a traves de tu voz"
|
21 |
+
examples = ['definir función', 'definir variable', 'definir clase']
|
22 |
+
article = "<a style='color:#eb9f59;' href = 'https://github.com/gandres-dev/Hackaton-Common-Voice'> Repositorio de la app"
|
23 |
+
demo = gr.Interface(fn=transcribe, inputs=inputs, outputs=[output1,output2],
|
24 |
+
title=title, description=description, article=article,
|
25 |
+
allow_flagging="never", theme="darkpeach", examples=examples,
|
26 |
+
live=True
|
27 |
+
)
|
28 |
+
|
29 |
+
if __name__ == "__main__":
|
30 |
+
demo.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
huggingsound
|