xinchen9 commited on
Commit
f1cebe3
·
verified ·
1 Parent(s): 785f505

[Update]Add function of start button

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -27,10 +27,10 @@ from about import (
27
  )
28
 
29
 
30
- def excute_udiff(diffusion_model_id, concept, attacker):
31
  print(f"my IP is {myip}, my port is {myport}")
32
  print(f"my input is diffusion_model_id: {diffusion_model_id}, concept: {concept}, attacker: {attacker}")
33
- result = requests.post('http://{}:{}/udiff'.format(myip, myport), json={"diffusion_model_id": diffusion_model_id, "concept": concept, "attacker": attacker})
34
  result = result.text[1:-1]
35
 
36
  return result
@@ -93,7 +93,7 @@ with gr.Blocks(css=custom_css) as demo:
93
  # ["CompVis/stable-diffusion-v1-4", "nudity", "text_grad"]
94
  # ], inputs=[diffusion_model_id, concept, attacker])
95
 
96
- # start_button.click(fn=excute_udiff, inputs=[diffusion_model_id, concept, attacker], outputs=result, api_name="udiff")
97
 
98
 
99
  # demo.queue(default_enabled=False, api_open=False, max_size=5).launch(debug=True, show_api=False)
 
27
  )
28
 
29
 
30
+ def excute_udiff(diffusion_model_id, concept, step):
31
  print(f"my IP is {myip}, my port is {myport}")
32
  print(f"my input is diffusion_model_id: {diffusion_model_id}, concept: {concept}, attacker: {attacker}")
33
+ result = requests.post('http://{}:{}/udiff'.format(myip, myport), json={"diffusion_model_id": diffusion_model_id, "concept": concept, "step": step})
34
  result = result.text[1:-1]
35
 
36
  return result
 
93
  # ["CompVis/stable-diffusion-v1-4", "nudity", "text_grad"]
94
  # ], inputs=[diffusion_model_id, concept, attacker])
95
 
96
+ start_button.click(fn=excute_udiff, inputs=[drop_model, drop, shown_columns_step], outputs=result, api_name="udiff")
97
 
98
 
99
  # demo.queue(default_enabled=False, api_open=False, max_size=5).launch(debug=True, show_api=False)