jcmachicao commited on
Commit
b1cd9e6
verified
1 Parent(s): a762f3e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -97,6 +97,8 @@ def visualizar_grafo():
97
  plt.close()
98
  return "graph.png"
99
 
 
 
100
  iface = gr.Blocks()
101
 
102
  with iface:
@@ -105,8 +107,10 @@ with iface:
105
 
106
  with gr.Row():
107
  gr.Markdown("## Red de Aportes:")
108
- graph_output = gr.Image(visualizar_grafo(), label="Red de Aportes")
109
-
 
 
110
  with gr.Row():
111
  nombre = gr.Dropdown(choices=students, label="Nombre del Estudiante")
112
 
@@ -116,7 +120,7 @@ with iface:
116
  submit_button = gr.Button("Agregar Aporte")
117
  submit_button.click(
118
  fn=agregar_aporte,
119
- inputs=[nombre, texto], # Fix: Now passing both inputs
120
  outputs=graph_output
121
  )
122
 
 
97
  plt.close()
98
  return "graph.png"
99
 
100
+ inicializar_grafo() # Call this before displaying the graph
101
+
102
  iface = gr.Blocks()
103
 
104
  with iface:
 
107
 
108
  with gr.Row():
109
  gr.Markdown("## Red de Aportes:")
110
+
111
+ graph_output = gr.Image(label="Red de Aportes") # Create an empty image widget
112
+ graph_output.update(value=visualizar_grafo()) # Update it after initializing graph
113
+
114
  with gr.Row():
115
  nombre = gr.Dropdown(choices=students, label="Nombre del Estudiante")
116
 
 
120
  submit_button = gr.Button("Agregar Aporte")
121
  submit_button.click(
122
  fn=agregar_aporte,
123
+ inputs=[nombre, texto],
124
  outputs=graph_output
125
  )
126