Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,10 +14,10 @@ is_spaces = True if "SPACE_ID" in os.environ else False
|
|
14 |
is_shared_ui = False
|
15 |
|
16 |
|
17 |
-
def excute_udiff(
|
18 |
print(f"my IP is {myip}, my port is {myport}")
|
19 |
-
print(f"my input is
|
20 |
-
result = requests.post('http://{}:{}/udiff'.format(myip, myport), json={"diffusion_model_id":
|
21 |
|
22 |
return f"The attack prompt is: {result}"
|
23 |
|
@@ -40,7 +40,7 @@ with gr.Blocks(css=css) as demo:
|
|
40 |
with gr.Row() as udiff:
|
41 |
with gr.Column():
|
42 |
# gr.Markdown("Please upload your model id.")
|
43 |
-
|
44 |
concept = gr.Textbox(label='concept')
|
45 |
attacker = gr.Textbox(label='attacker')
|
46 |
|
@@ -52,9 +52,9 @@ with gr.Blocks(css=css) as demo:
|
|
52 |
with gr.Column():
|
53 |
gr.Examples(examples=[
|
54 |
["runwayml/stable-diffusion-v1-5", "nudity", "text_grad"]
|
55 |
-
], inputs=[
|
56 |
|
57 |
-
start_button.click(fn=excute_udiff, inputs=[
|
58 |
|
59 |
|
60 |
# demo.queue(default_enabled=False, api_open=False, max_size=5).launch(debug=True, show_api=False)
|
|
|
14 |
is_shared_ui = False
|
15 |
|
16 |
|
17 |
+
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 |
|
|
|
40 |
with gr.Row() as udiff:
|
41 |
with gr.Column():
|
42 |
# gr.Markdown("Please upload your model id.")
|
43 |
+
diffusion_model_id = gr.Textbox(label='diffusion_model_id')
|
44 |
concept = gr.Textbox(label='concept')
|
45 |
attacker = gr.Textbox(label='attacker')
|
46 |
|
|
|
52 |
with gr.Column():
|
53 |
gr.Examples(examples=[
|
54 |
["runwayml/stable-diffusion-v1-5", "nudity", "text_grad"]
|
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")
|
58 |
|
59 |
|
60 |
# demo.queue(default_enabled=False, api_open=False, max_size=5).launch(debug=True, show_api=False)
|