roncmic commited on
Commit
9adc147
·
verified ·
1 Parent(s): cbdad39

Update app_pyvis_new.py

Browse files
Files changed (1) hide show
  1. app_pyvis_new.py +10 -0
app_pyvis_new.py CHANGED
@@ -160,6 +160,10 @@ def generate_with_temperature(prompt, temperature=1.0, top_k=50, top_p=0.95, max
160
  decoded_texts = tokenizer.batch_decode(outputs, skip_special_tokens=True)
161
  return decoded_texts
162
 
 
 
 
 
163
  def generate_new_relations(
164
  graph_df: pd.DataFrame,
165
  new_node: str,
@@ -775,6 +779,12 @@ def build_interface():
775
  outputs=outputs[:3] # Do not overwrite the updated graph slot
776
  )
777
 
 
 
 
 
 
 
778
  # Handle saving data on button click
779
  save_button.click(
780
  fn=save_data,
 
160
  decoded_texts = tokenizer.batch_decode(outputs, skip_special_tokens=True)
161
  return decoded_texts
162
 
163
+ def clear_scenario_graph():
164
+ # Return an empty string to clear the scenario graph
165
+ return '<div>No scenario graph available.</div>'
166
+
167
  def generate_new_relations(
168
  graph_df: pd.DataFrame,
169
  new_node: str,
 
779
  outputs=outputs[:3] # Do not overwrite the updated graph slot
780
  )
781
 
782
+ row_dropdown.change(
783
+ fn=clear_scenario_graph,
784
+ inputs=[],
785
+ outputs=[outputs[3]] # Clear the updated scenario graph output
786
+ )
787
+
788
  # Handle saving data on button click
789
  save_button.click(
790
  fn=save_data,