jcmachicao commited on
Commit
86caf5e
·
verified ·
1 Parent(s): 76b57ae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -32
app.py CHANGED
@@ -6,38 +6,41 @@ from utils_gdmk import (
6
  )
7
 
8
  G = nx.DiGraph()
9
- inicializar_grafo() # Call this before displaying the graph
10
  students = cargar_nombres("nombres.txt")
11
  VOCABULARY = cargar_vocabulario("vocabulario_postdoc.txt")
12
 
13
- iface = gr.Blocks()
14
-
15
- with iface:
16
- with gr.Row():
17
- gr.Markdown("# Diagrama de Aportes de Participantes")
18
-
19
- with gr.Row():
20
- gr.Markdown("## Red de Aportes:")
21
- graph_output = gr.Image(visualizar_grafo(), label="Red de Aportes") # Correct
22
-
23
- with gr.Row():
24
- nombre = gr.Dropdown(choices=students, label="Nombre del Estudiante")
25
-
26
- with gr.Row():
27
- texto = gr.Textbox(label="Tu aporte")
28
-
29
- submit_button = gr.Button("Agregar Aporte")
30
- submit_button.click(
31
- fn=agregar_aporte,
32
- inputs=[nombre, texto],
33
- outputs=[graph_output]
34
- )
35
-
36
- reload_button = gr.Button("🔄 Recargar Diagrama desde Repositorio")
37
- reload_button.click(
38
- fn=reload_data,
39
- inputs=[],
40
- outputs=[graph_output]
41
- )
42
-
43
- iface.launch(share=True)
 
 
 
 
6
  )
7
 
8
  G = nx.DiGraph()
9
+ inicializar_grafo() # Llamar antes de mostrar el grafo
10
  students = cargar_nombres("nombres.txt")
11
  VOCABULARY = cargar_vocabulario("vocabulario_postdoc.txt")
12
 
13
+ def iniciar_interfaz():
14
+ iface = gr.Blocks()
15
+ with iface:
16
+ with gr.Row():
17
+ gr.Markdown("# Diagrama de Aportes de Participantes")
18
+
19
+ with gr.Row():
20
+ gr.Markdown("## Red de Aportes:")
21
+ graph_output = gr.Image("graph.png", label="Red de Aportes") # Evita llamada prematura
22
+
23
+ with gr.Row():
24
+ nombre = gr.Dropdown(choices=students, label="Nombre del Estudiante")
25
+
26
+ with gr.Row():
27
+ texto = gr.Textbox(label="Tu aporte")
28
+
29
+ submit_button = gr.Button("Agregar Aporte")
30
+ submit_button.click(
31
+ fn=agregar_aporte,
32
+ inputs=[nombre, texto],
33
+ outputs=[graph_output]
34
+ )
35
+
36
+ reload_button = gr.Button("🔄 Recargar Diagrama desde Repositorio")
37
+ reload_button.click(
38
+ fn=reload_data,
39
+ inputs=[],
40
+ outputs=[graph_output]
41
+ )
42
+
43
+ iface.launch(share=True)
44
+
45
+ if __name__ == "__main__":
46
+ iniciar_interfaz()