Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -59,40 +59,40 @@ def main():
|
|
59 |
with gr.Blocks() as demo:
|
60 |
gr.Markdown("# Aplicaci贸n de Clasificaci贸n y Traducci贸n")
|
61 |
|
62 |
-
input_texto_clasificacion = gr.Textbox(label="Ingresa la noticia aqu铆:")
|
63 |
-
modelo_seleccion = gr.Dropdown(
|
64 |
-
["Transformer Encoder Apilado", "Transformer Positional Encoding", "Simple RNN", "LSTM"],
|
65 |
-
label="Selecciona el modelo:"
|
66 |
-
)
|
67 |
-
output_clasificacion = gr.Textbox(label="Resultado de la clasificaci贸n:")
|
68 |
-
boton_clasificar = gr.Button("Clasificar")
|
69 |
-
|
70 |
-
input_texto_traduccion = gr.Textbox(label="Ingresa el texto en ingl茅s:")
|
71 |
-
output_traduccion = gr.Textbox(label="Texto traducido al espa帽ol:")
|
72 |
-
boton_traducir = gr.Button("Traducir")
|
73 |
-
|
74 |
with gr.TabbedInterface([
|
75 |
gr.TabItem(
|
76 |
[
|
77 |
gr.Markdown("## Clasificaci贸n de Noticias"),
|
78 |
-
input_texto_clasificacion,
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
|
|
82 |
],
|
83 |
label="Clasificaci贸n de Noticias"
|
84 |
),
|
85 |
gr.TabItem(
|
86 |
[
|
87 |
gr.Markdown("## Traducci贸n de Ingl茅s a Espa帽ol"),
|
88 |
-
input_texto_traduccion,
|
89 |
-
boton_traducir,
|
90 |
-
output_traduccion
|
91 |
],
|
92 |
label="Traducci贸n (Ingl茅s a Espa帽ol)"
|
93 |
)
|
94 |
]) as tabs:
|
|
|
|
|
|
|
|
|
95 |
boton_clasificar.click(fn=clasificar_noticia, inputs=[input_texto_clasificacion, modelo_seleccion], outputs=output_clasificacion)
|
|
|
|
|
|
|
|
|
96 |
boton_traducir.click(fn=traducir_texto_en_es, inputs=input_texto_traduccion, outputs=output_traduccion)
|
97 |
|
98 |
demo.launch()
|
|
|
59 |
with gr.Blocks() as demo:
|
60 |
gr.Markdown("# Aplicaci贸n de Clasificaci贸n y Traducci贸n")
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
with gr.TabbedInterface([
|
63 |
gr.TabItem(
|
64 |
[
|
65 |
gr.Markdown("## Clasificaci贸n de Noticias"),
|
66 |
+
gr.Textbox(label="Ingresa la noticia aqu铆:", elem_id="input_texto_clasificacion"),
|
67 |
+
gr.Dropdown(
|
68 |
+
["Transformer Encoder Apilado", "Transformer Positional Encoding", "Simple RNN", "LSTM"],
|
69 |
+
label="Selecciona el modelo:",
|
70 |
+
elem_id="modelo_seleccion"
|
71 |
+
),
|
72 |
+
gr.Button("Clasificar", elem_id="boton_clasificar"),
|
73 |
+
gr.Textbox(label="Resultado de la clasificaci贸n:", elem_id="output_clasificacion")
|
74 |
],
|
75 |
label="Clasificaci贸n de Noticias"
|
76 |
),
|
77 |
gr.TabItem(
|
78 |
[
|
79 |
gr.Markdown("## Traducci贸n de Ingl茅s a Espa帽ol"),
|
80 |
+
gr.Textbox(label="Ingresa el texto en ingl茅s:", elem_id="input_texto_traduccion"),
|
81 |
+
gr.Button("Traducir", elem_id="boton_traducir"),
|
82 |
+
gr.Textbox(label="Texto traducido al espa帽ol:", elem_id="output_traduccion")
|
83 |
],
|
84 |
label="Traducci贸n (Ingl茅s a Espa帽ol)"
|
85 |
)
|
86 |
]) as tabs:
|
87 |
+
input_texto_clasificacion = gr.get_component("input_texto_clasificacion")
|
88 |
+
modelo_seleccion = gr.get_component("modelo_seleccion")
|
89 |
+
output_clasificacion = gr.get_component("output_clasificacion")
|
90 |
+
boton_clasificar = gr.get_component("boton_clasificar")
|
91 |
boton_clasificar.click(fn=clasificar_noticia, inputs=[input_texto_clasificacion, modelo_seleccion], outputs=output_clasificacion)
|
92 |
+
|
93 |
+
input_texto_traduccion = gr.get_component("input_texto_traduccion")
|
94 |
+
output_traduccion = gr.get_component("output_traduccion")
|
95 |
+
boton_traducir = gr.get_component("boton_traducir")
|
96 |
boton_traducir.click(fn=traducir_texto_en_es, inputs=input_texto_traduccion, outputs=output_traduccion)
|
97 |
|
98 |
demo.launch()
|