juancamval commited on
Commit
923e20b
verified
1 Parent(s): 1b24ba9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -36
app.py CHANGED
@@ -34,42 +34,24 @@ def main():
34
  with gr.Blocks() as demo:
35
  gr.Markdown("# Aplicaci贸n de Clasificaci贸n y Traducci贸n")
36
 
37
- input_texto_clasificacion = gr.Textbox(label="Ingresa la noticia aqu铆:")
38
- modelo_seleccion = gr.Dropdown(
39
- ["Transformer Encoder Apilado", "Transformer Positional Encoding", "Simple RNN", "LSTM"],
40
- label="Selecciona el modelo:"
41
- )
42
- output_clasificacion = gr.Textbox(label="Resultado de la clasificaci贸n:")
43
- boton_clasificar = gr.Button("Clasificar")
44
-
45
- input_texto_traduccion = gr.Textbox(label="Ingresa el texto en ingl茅s:")
46
- output_traduccion = gr.Textbox(label="Texto traducido al espa帽ol:")
47
- boton_traducir = gr.Button("Traducir")
48
-
49
- with gr.TabbedInterface(
50
- [
51
- gr.Column(
52
- [
53
- gr.Markdown("## Clasificaci贸n de Noticias"),
54
- input_texto_clasificacion,
55
- modelo_seleccion,
56
- boton_clasificar,
57
- output_clasificacion,
58
- ]
59
- ),
60
- gr.Column(
61
- [
62
- gr.Markdown("## Traducci贸n de Ingl茅s a Espa帽ol"),
63
- input_texto_traduccion,
64
- boton_traducir,
65
- output_traduccion,
66
- ]
67
- ),
68
- ],
69
- ["Clasificaci贸n de Noticias", "Traducci贸n (Ingl茅s a Espa帽ol)"]
70
- ) as tabs:
71
- boton_clasificar.click(fn=clasificar_noticia, inputs=[input_texto_clasificacion, modelo_seleccion], outputs=output_clasificacion)
72
- boton_traducir.click(fn=traducir_texto_en_es, inputs=[input_texto_traduccion], outputs=output_traduccion)
73
 
74
  demo.launch()
75
 
 
34
  with gr.Blocks() as demo:
35
  gr.Markdown("# Aplicaci贸n de Clasificaci贸n y Traducci贸n")
36
 
37
+ with gr.TabbedInterface() as tabs:
38
+ with gr.TabItem("Clasificaci贸n de Noticias"):
39
+ gr.Markdown("## Clasificaci贸n de Noticias")
40
+ input_texto_clasificacion = gr.Textbox(label="Ingresa la noticia aqu铆:")
41
+ modelo_seleccion = gr.Dropdown(
42
+ ["Transformer Encoder Apilado", "Transformer Positional Encoding", "Simple RNN", "LSTM"],
43
+ label="Selecciona el modelo:"
44
+ )
45
+ output_clasificacion = gr.Textbox(label="Resultado de la clasificaci贸n:")
46
+ boton_clasificar = gr.Button("Clasificar")
47
+ boton_clasificar.click(fn=clasificar_noticia, inputs=[input_texto_clasificacion, modelo_seleccion], outputs=output_clasificacion)
48
+
49
+ with gr.TabItem("Traducci贸n (Ingl茅s a Espa帽ol)"):
50
+ gr.Markdown("## Traducci贸n de Ingl茅s a Espa帽ol")
51
+ input_texto_traduccion = gr.Textbox(label="Ingresa el texto en ingl茅s:")
52
+ output_traduccion = gr.Textbox(label="Texto traducido al espa帽ol:")
53
+ boton_traducir = gr.Button("Traducir")
54
+ boton_traducir.click(fn=traducir_texto_en_es, inputs=[input_texto_traduccion], outputs=output_traduccion)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  demo.launch()
57