Spaces:
Runtime error
Runtime error
GuillermoPuma
commited on
Commit
•
9a3e539
1
Parent(s):
0b53366
add audios
Browse files- app.py +120 -14
- wav/andreabravo.wav +0 -0
- wav/asignar_a_c.wav +0 -0
- wav/asignar_c_b.wav +0 -0
- wav/bravoigual.wav +0 -0
- wav/comentario.wav +0 -0
- wav/comentario2.wav +0 -0
- wav/definir_var_andrea.wav +0 -0
- wav/definira.wav +0 -0
- wav/definirandrea.wav +0 -0
- wav/definirb.wav +0 -0
- wav/funcion.wav +0 -0
- wav/iteracion.wav +0 -0
- wav/llamada.wav +0 -0
- wav/regresa.wav +0 -0
- wav/regresarandrea.wav +0 -0
- wav/terminar_bloque.wav +0 -0
app.py
CHANGED
@@ -10,6 +10,113 @@ from models.variables_globales import *
|
|
10 |
# creación del modelo
|
11 |
model = SpeechRecognitionModel("patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm")
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
# Variables globales
|
14 |
bloque = '' # Define el contexto (si es función, condicional, ciclo, etc.)
|
15 |
codigo = None # Guarda el código hasta el momento
|
@@ -43,7 +150,7 @@ output1 = gr.outputs.Textbox(label="Asi se ve tu código")
|
|
43 |
output2 = gr.outputs.Textbox(label="Lo que entendió la caracola fue:")
|
44 |
|
45 |
title = "Caracola App"
|
46 |
-
description = "Aplicación que ayuda a programar a traves de tu voz"
|
47 |
# ,'mientras variable alpha es menor igual a numero dos'
|
48 |
# ,'Definir variable con nombre india igual a numero uno'
|
49 |
input2 = gr.inputs.Textbox(lines=0, placeholder="Aqui aparece el texto en español de los ejemplos")
|
@@ -52,18 +159,18 @@ input3 = gr.inputs.Textbox(lines=0, placeholder="Aqui aparece el codigo en pytho
|
|
52 |
output_html = gr.outputs.HTML(label='Asi se ve tu código:')
|
53 |
|
54 |
examples = [
|
55 |
-
['wav/comentario.wav','agregar comentario mi primer función', '# mi primer funcion'],
|
56 |
-
['wav/funcion.wav','definir función con nombre mágica y parámetros noviembre', 'def magica(n):'],
|
57 |
-
['wav/definira.wav','definir variable con nombre andrea igual a natural cero', 'a=0'],
|
58 |
-
['wav/definirb.wav','definir variable con nombre bravo igual a natural uno', 'b = 1'],
|
59 |
-
['wav/iteracion.wav','ejecuta iteracion para india en un rango noviembre', 'for i in range(n)'],
|
60 |
-
['wav/asignar_c_b.wav','asignar variable carlos con bravo', 'c=b'],
|
61 |
-
['wav/andreabravo.wav','asignar variable bravo con andrea mas bravo', 'b = a + b'],
|
62 |
-
['wav/asignar_a_c.wav','asignar variable andrea con carlos', 'a=c'],
|
63 |
-
['wav/terminar_bloque.wav','terminar bloque',''],
|
64 |
-
['wav/comentario2.wav','agregar comentario fin de ciclo', '# fin de ciclo'],
|
65 |
-
['wav/regresa.wav','regresa variable andrea', 'return a'],
|
66 |
-
['wav/llamada.wav', 'ejecuta mágica con argumentos diez', 'magica(10)']
|
67 |
]
|
68 |
|
69 |
article = "<a style='color:#eb9f59;' href = 'https://github.com/gandres-dev/Hackaton-Common-Voice'> Repositorio de la app"
|
@@ -73,5 +180,4 @@ demo = gr.Interface(fn=transcribe, inputs=[inputs, input2, input3], outputs=[out
|
|
73 |
allow_flagging="never", theme="darkpeach",
|
74 |
)
|
75 |
|
76 |
-
|
77 |
demo.launch()
|
|
|
10 |
# creación del modelo
|
11 |
model = SpeechRecognitionModel("patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm")
|
12 |
|
13 |
+
|
14 |
+
|
15 |
+
tabla='''
|
16 |
+
<style type="text/css">
|
17 |
+
.tg {border-collapse:collapse;border-spacing:0;}
|
18 |
+
.tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
|
19 |
+
overflow:hidden;padding:10px 5px;word-break:normal;}
|
20 |
+
.tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
|
21 |
+
font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}
|
22 |
+
.tg .tg-r31x{color:#ffffff;text-align:center;vertical-align:top}
|
23 |
+
.tg .tg-urxo{border-color:#ffffff;color:#ffffff;text-align:center;vertical-align:top}
|
24 |
+
.tg .tg-iejp{border-color:#ffffff;color:#ffffff;font-weight:bold;text-align:center;vertical-align:top}
|
25 |
+
</style>
|
26 |
+
<table class="tg">
|
27 |
+
<thead>
|
28 |
+
<tr>
|
29 |
+
<th class="tg-iejp">Fonético</th>
|
30 |
+
<th class="tg-r31x">andrea</th>
|
31 |
+
<th class="tg-r31x">bravo</th>
|
32 |
+
<th class="tg-r31x">carlos</th>
|
33 |
+
<th class="tg-r31x">delta</th>
|
34 |
+
<th class="tg-r31x">eduardo</th>
|
35 |
+
<th class="tg-r31x">fernando</th>
|
36 |
+
<th class="tg-r31x">garcia</th>
|
37 |
+
<th class="tg-r31x">hotel</th>
|
38 |
+
<th class="tg-r31x">india</th>
|
39 |
+
<th class="tg-r31x">julieta</th>
|
40 |
+
<th class="tg-r31x">kilo</th>
|
41 |
+
<th class="tg-r31x">lima</th>
|
42 |
+
<th class="tg-r31x">miguel</th>
|
43 |
+
<th class="tg-r31x">noviembre</th>
|
44 |
+
</tr>
|
45 |
+
</thead>
|
46 |
+
<tbody>
|
47 |
+
<tr>
|
48 |
+
<td class="tg-iejp">Letra</td>
|
49 |
+
<td class="tg-r31x">a</td>
|
50 |
+
<td class="tg-r31x">b</td>
|
51 |
+
<td class="tg-r31x">c</td>
|
52 |
+
<td class="tg-r31x">d</td>
|
53 |
+
<td class="tg-r31x">e</td>
|
54 |
+
<td class="tg-r31x">f</td>
|
55 |
+
<td class="tg-r31x">g</td>
|
56 |
+
<td class="tg-r31x">h</td>
|
57 |
+
<td class="tg-r31x">i</td>
|
58 |
+
<td class="tg-r31x">j</td>
|
59 |
+
<td class="tg-r31x">k</td>
|
60 |
+
<td class="tg-r31x">l</td>
|
61 |
+
<td class="tg-r31x">m</td>
|
62 |
+
<td class="tg-r31x">n</td>
|
63 |
+
</tr>
|
64 |
+
<tr>
|
65 |
+
<td class="tg-urxo"></td>
|
66 |
+
<td class="tg-r31x"></td>
|
67 |
+
<td class="tg-r31x"></td>
|
68 |
+
<td class="tg-r31x"></td>
|
69 |
+
<td class="tg-r31x"></td>
|
70 |
+
<td class="tg-r31x"></td>
|
71 |
+
<td class="tg-r31x"></td>
|
72 |
+
<td class="tg-r31x"></td>
|
73 |
+
<td class="tg-r31x"></td>
|
74 |
+
<td class="tg-r31x"></td>
|
75 |
+
<td class="tg-r31x"></td>
|
76 |
+
<td class="tg-r31x"></td>
|
77 |
+
<td class="tg-r31x"></td>
|
78 |
+
<td class="tg-r31x"></td>
|
79 |
+
<td class="tg-r31x"></td>
|
80 |
+
</tr>
|
81 |
+
<tr>
|
82 |
+
<td class="tg-iejp">Fonético</td>
|
83 |
+
<td class="tg-r31x">oscar</td>
|
84 |
+
<td class="tg-r31x">papa</td>
|
85 |
+
<td class="tg-r31x">queretaro</td>
|
86 |
+
<td class="tg-r31x">romero</td>
|
87 |
+
<td class="tg-r31x">sierra</td>
|
88 |
+
<td class="tg-r31x">tango</td>
|
89 |
+
<td class="tg-r31x">uniforme</td>
|
90 |
+
<td class="tg-r31x">victor</td>
|
91 |
+
<td class="tg-r31x">waffle</td>
|
92 |
+
<td class="tg-r31x">equis</td>
|
93 |
+
<td class="tg-r31x">yarda</td>
|
94 |
+
<td class="tg-r31x">zapato</td>
|
95 |
+
<td class="tg-r31x"></td>
|
96 |
+
<td class="tg-r31x"></td>
|
97 |
+
</tr>
|
98 |
+
<tr>
|
99 |
+
<td class="tg-iejp">Letra</td>
|
100 |
+
<td class="tg-r31x">o</td>
|
101 |
+
<td class="tg-r31x">p</td>
|
102 |
+
<td class="tg-r31x">q</td>
|
103 |
+
<td class="tg-r31x">r</td>
|
104 |
+
<td class="tg-r31x">s</td>
|
105 |
+
<td class="tg-r31x">t</td>
|
106 |
+
<td class="tg-r31x">u</td>
|
107 |
+
<td class="tg-r31x">v</td>
|
108 |
+
<td class="tg-r31x">w</td>
|
109 |
+
<td class="tg-r31x">x</td>
|
110 |
+
<td class="tg-r31x">y</td>
|
111 |
+
<td class="tg-r31x">z</td>
|
112 |
+
<td class="tg-r31x"></td>
|
113 |
+
<td class="tg-r31x"></td>
|
114 |
+
</tr>
|
115 |
+
</tbody>
|
116 |
+
</table>
|
117 |
+
'''
|
118 |
+
|
119 |
+
|
120 |
# Variables globales
|
121 |
bloque = '' # Define el contexto (si es función, condicional, ciclo, etc.)
|
122 |
codigo = None # Guarda el código hasta el momento
|
|
|
150 |
output2 = gr.outputs.Textbox(label="Lo que entendió la caracola fue:")
|
151 |
|
152 |
title = "Caracola App"
|
153 |
+
description = '<p style="color:white">Aplicación que ayuda a programar a traves de tu voz.\nSe usa el siguiente diccionario fonético para capturar las variables de una letra.</p>'+tabla+'<br> <h3 style="color:white"> Instrucciones </h3> <p style="color:white"> Selecciona uno de los ejemplos y da click en enviar para convertir comandos de voz en código! </p>'
|
154 |
# ,'mientras variable alpha es menor igual a numero dos'
|
155 |
# ,'Definir variable con nombre india igual a numero uno'
|
156 |
input2 = gr.inputs.Textbox(lines=0, placeholder="Aqui aparece el texto en español de los ejemplos")
|
|
|
159 |
output_html = gr.outputs.HTML(label='Asi se ve tu código:')
|
160 |
|
161 |
examples = [
|
162 |
+
['../wav/comentario.wav','agregar comentario mi primer función', '# mi primer funcion'],
|
163 |
+
['../wav/funcion.wav','definir función con nombre mágica y parámetros noviembre', 'def magica(n):'],
|
164 |
+
['../wav/definira.wav','definir variable con nombre andrea igual a natural cero', 'a=0'],
|
165 |
+
['../wav/definirb.wav','definir variable con nombre bravo igual a natural uno', 'b = 1'],
|
166 |
+
['../wav/iteracion.wav','ejecuta iteracion para india en un rango noviembre', 'for i in range(n)'],
|
167 |
+
['../wav/asignar_c_b.wav','asignar variable carlos con bravo', 'c=b'],
|
168 |
+
['../wav/andreabravo.wav','asignar variable bravo con andrea mas bravo', 'b = a + b'],
|
169 |
+
['../wav/asignar_a_c.wav','asignar variable andrea con carlos', 'a=c'],
|
170 |
+
['../wav/terminar_bloque.wav','terminar bloque',''],
|
171 |
+
['../wav/comentario2.wav','agregar comentario fin de ciclo', '# fin de ciclo'],
|
172 |
+
['../wav/regresa.wav','regresa variable andrea', 'return a'],
|
173 |
+
['../wav/llamada.wav', 'ejecuta mágica con argumentos diez', 'magica(10)']
|
174 |
]
|
175 |
|
176 |
article = "<a style='color:#eb9f59;' href = 'https://github.com/gandres-dev/Hackaton-Common-Voice'> Repositorio de la app"
|
|
|
180 |
allow_flagging="never", theme="darkpeach",
|
181 |
)
|
182 |
|
|
|
183 |
demo.launch()
|
wav/andreabravo.wav
ADDED
Binary file (542 kB). View file
|
|
wav/asignar_a_c.wav
ADDED
Binary file (507 kB). View file
|
|
wav/asignar_c_b.wav
ADDED
Binary file (438 kB). View file
|
|
wav/bravoigual.wav
ADDED
Binary file (593 kB). View file
|
|
wav/comentario.wav
ADDED
Binary file (467 kB). View file
|
|
wav/comentario2.wav
ADDED
Binary file (442 kB). View file
|
|
wav/definir_var_andrea.wav
ADDED
Binary file (703 kB). View file
|
|
wav/definira.wav
ADDED
Binary file (699 kB). View file
|
|
wav/definirandrea.wav
ADDED
Binary file (576 kB). View file
|
|
wav/definirb.wav
ADDED
Binary file (735 kB). View file
|
|
wav/funcion.wav
ADDED
Binary file (639 kB). View file
|
|
wav/iteracion.wav
ADDED
Binary file (737 kB). View file
|
|
wav/llamada.wav
ADDED
Binary file (536 kB). View file
|
|
wav/regresa.wav
ADDED
Binary file (340 kB). View file
|
|
wav/regresarandrea.wav
ADDED
Binary file (426 kB). View file
|
|
wav/terminar_bloque.wav
ADDED
Binary file (317 kB). View file
|
|