Kaixuanliu commited on
Commit
dc1cf71
1 Parent(s): f4e8b6b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -32,9 +32,18 @@ def excute_udiff(diffusion_model_id, concept, steps):
32
  print(f"my input is diffusion_model_id: {diffusion_model_id}, concept: {concept}, steps: {steps}")
33
  result = requests.post('http://{}:{}/udiff'.format(myip, myport), json={"diffusion_model_id": diffusion_model_id, "concept": concept, "steps": steps})
34
  print(f"result: {result}")
35
- result = result.text[1:-1]
 
 
 
 
 
 
 
 
 
36
 
37
- return result
38
 
39
 
40
  css = '''
@@ -90,7 +99,7 @@ with gr.Blocks(css=custom_css) as demo:
90
  img2 = gr.Image("images/cheetah.jpg",label="Image Gnerated by Prompt of UnlearnDiffAtk",width=260,show_share_button=False,show_download_button=False)
91
 
92
 
93
- start_button.click(fn=excute_udiff, inputs=[drop_model, drop, shown_columns_step], outputs=[text_ouput], api_name="udiff")
94
 
95
 
96
  demo.queue().launch(server_name='0.0.0.0')
 
32
  print(f"my input is diffusion_model_id: {diffusion_model_id}, concept: {concept}, steps: {steps}")
33
  result = requests.post('http://{}:{}/udiff'.format(myip, myport), json={"diffusion_model_id": diffusion_model_id, "concept": concept, "steps": steps})
34
  print(f"result: {result}")
35
+ # result = result.text[1:-1]
36
+ res1 = ""
37
+ res2 = ""
38
+ if response.status_code == 200:
39
+ response_json = response.json()
40
+ print(response_json)
41
+ res1 = response_json['input_prompt']
42
+ res2 = response_json['output_prompt']
43
+ else:
44
+ print(f"Request failed with status code {response.status_code}")
45
 
46
+ return res1, res2
47
 
48
 
49
  css = '''
 
99
  img2 = gr.Image("images/cheetah.jpg",label="Image Gnerated by Prompt of UnlearnDiffAtk",width=260,show_share_button=False,show_download_button=False)
100
 
101
 
102
+ start_button.click(fn=excute_udiff, inputs=[drop_model, drop, shown_columns_step], outputs=[text_input, text_ouput], api_name="udiff")
103
 
104
 
105
  demo.queue().launch(server_name='0.0.0.0')