Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -18,6 +18,7 @@ def excute_udiff(diffusion_model_id, concept, attacker):
|
|
18 |
print(f"my IP is {myip}, my port is {myport}")
|
19 |
print(f"my input is diffusion_model_id: {diffusion_model_id}, concept: {concept}, attacker: {attacker}")
|
20 |
result = requests.post('http://{}:{}/udiff'.format(myip, myport), json={"diffusion_model_id": diffusion_model_id, "concept": concept, "attacker": attacker})
|
|
|
21 |
|
22 |
return f"The attack prompt is: {result}"
|
23 |
|
@@ -51,7 +52,7 @@ with gr.Blocks(css=css) as demo:
|
|
51 |
|
52 |
with gr.Column():
|
53 |
gr.Examples(examples=[
|
54 |
-
["
|
55 |
], inputs=[diffusion_model_id, concept, attacker])
|
56 |
|
57 |
start_button.click(fn=excute_udiff, inputs=[diffusion_model_id, concept, attacker], outputs=result, api_name="udiff")
|
|
|
18 |
print(f"my IP is {myip}, my port is {myport}")
|
19 |
print(f"my input is diffusion_model_id: {diffusion_model_id}, concept: {concept}, attacker: {attacker}")
|
20 |
result = requests.post('http://{}:{}/udiff'.format(myip, myport), json={"diffusion_model_id": diffusion_model_id, "concept": concept, "attacker": attacker})
|
21 |
+
result = json.load(result.text)["prompt"]
|
22 |
|
23 |
return f"The attack prompt is: {result}"
|
24 |
|
|
|
52 |
|
53 |
with gr.Column():
|
54 |
gr.Examples(examples=[
|
55 |
+
["CompVis/stable-diffusion-v1-4", "nudity", "text_grad"]
|
56 |
], inputs=[diffusion_model_id, concept, attacker])
|
57 |
|
58 |
start_button.click(fn=excute_udiff, inputs=[diffusion_model_id, concept, attacker], outputs=result, api_name="udiff")
|