YuWang0103 commited on
Commit
67ad3dd
·
verified ·
1 Parent(s): bfd34aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -59,7 +59,7 @@ def predict(text, num_nodes = None):
59
  return images[0], images[1], images[2], ccs[0], ccs[1], ccs[2], degs[0], degs[1], degs[2], avg_cc, avg_deg
60
 
61
  def clear(input_text):
62
- return None, None
63
 
64
 
65
  with gr.Blocks() as demo:
@@ -68,7 +68,7 @@ with gr.Blocks() as demo:
68
  with gr.Column():
69
  input_text = gr.Textbox(label="Input your text prompt here", placeholder="Type here...")
70
  with gr.Column():
71
- input_num = gr.Slider(1, 200, value=10, label="Count", info="Number of nodes in the graph to be generated")
72
  with gr.Column():
73
  gr.Markdown("### Suggested Prompts")
74
  gr.Markdown("1. Create a complex network with high clustering coefficient.\n2. Create a graph with extremely low number of triangles.\n 3. Please give me a Power Network with extremely low number of triangles but with medium level of average degree.")
@@ -90,8 +90,9 @@ with gr.Blocks() as demo:
90
 
91
  # Change function is linked to the submit button
92
  submit_button.click(fn=predict, inputs=[input_text, input_num], outputs=output_images + output_texts_cc + output_texts_deg + [avg_cc_text, avg_deg_text])
 
93
 
94
  # Clear function resets the text input and clears the outputs
95
- clear_button.click(fn=clear, inputs=input_text, outputs=output_images + output_texts_cc + output_texts_deg + [avg_cc_text, avg_deg_text])
96
 
97
  demo.launch()
 
59
  return images[0], images[1], images[2], ccs[0], ccs[1], ccs[2], degs[0], degs[1], degs[2], avg_cc, avg_deg
60
 
61
  def clear(input_text):
62
+ return None, None, None, None, None, None, None, None, None, None, None
63
 
64
 
65
  with gr.Blocks() as demo:
 
68
  with gr.Column():
69
  input_text = gr.Textbox(label="Input your text prompt here", placeholder="Type here...")
70
  with gr.Column():
71
+ input_num = gr.Slider(5, 200, value=10, label="Count", info="Number of nodes in the graph to be generated")
72
  with gr.Column():
73
  gr.Markdown("### Suggested Prompts")
74
  gr.Markdown("1. Create a complex network with high clustering coefficient.\n2. Create a graph with extremely low number of triangles.\n 3. Please give me a Power Network with extremely low number of triangles but with medium level of average degree.")
 
90
 
91
  # Change function is linked to the submit button
92
  submit_button.click(fn=predict, inputs=[input_text, input_num], outputs=output_images + output_texts_cc + output_texts_deg + [avg_cc_text, avg_deg_text])
93
+ input_text.submit(fn=predict, inputs=[input_text, input_num], outputs=output_images + output_texts_cc + output_texts_deg + [avg_cc_text, avg_deg_text])
94
 
95
  # Clear function resets the text input and clears the outputs
96
+ clear_button.click(fn=clear, inputs=[input_text], outputs=output_images + output_texts_cc + output_texts_deg + [avg_cc_text, avg_deg_text])
97
 
98
  demo.launch()