Spaces:
Sleeping
Sleeping
Kaixuanliu
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -37,10 +37,10 @@ def process_image_from_binary(img_stream):
|
|
37 |
|
38 |
return img
|
39 |
|
40 |
-
def excute_udiff(diffusion_model_id, concept, steps):
|
41 |
print(f"my IP is {myip}, my port is {myport}")
|
42 |
print(f"my input is diffusion_model_id: {diffusion_model_id}, concept: {concept}, steps: {steps}")
|
43 |
-
response = requests.post('http://{}:{}/udiff'.format(myip, myport), json={"diffusion_model_id": diffusion_model_id, "concept": concept, "steps": steps})
|
44 |
print(f"result: {response}")
|
45 |
# result = result.text[1:-1]
|
46 |
prompt1 = ""
|
@@ -116,7 +116,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
116 |
result_img = gr.Image(label="Image Gnerated by Prompt of UnlearnDiffAtk",width=260,show_share_button=False,show_download_button=False)
|
117 |
|
118 |
|
119 |
-
start_button.click(fn=excute_udiff, inputs=[drop_model, drop, shown_columns_step,
|
120 |
|
121 |
|
122 |
demo.queue().launch(server_name='0.0.0.0')
|
|
|
37 |
|
38 |
return img
|
39 |
|
40 |
+
def excute_udiff(diffusion_model_id, concept, steps, attack_id):
|
41 |
print(f"my IP is {myip}, my port is {myport}")
|
42 |
print(f"my input is diffusion_model_id: {diffusion_model_id}, concept: {concept}, steps: {steps}")
|
43 |
+
response = requests.post('http://{}:{}/udiff'.format(myip, myport), json={"diffusion_model_id": diffusion_model_id, "concept": concept, "steps": steps, "attack_id": attack_id})
|
44 |
print(f"result: {response}")
|
45 |
# result = result.text[1:-1]
|
46 |
prompt1 = ""
|
|
|
116 |
result_img = gr.Image(label="Image Gnerated by Prompt of UnlearnDiffAtk",width=260,show_share_button=False,show_download_button=False)
|
117 |
|
118 |
|
119 |
+
start_button.click(fn=excute_udiff, inputs=[drop_model, drop, shown_columns_step, atk_idx], outputs=[text_input, text_ouput, orig_img, result_img], api_name="udiff")
|
120 |
|
121 |
|
122 |
demo.queue().launch(server_name='0.0.0.0')
|