Spaces:
Running
Running
root
commited on
Commit
·
ced37a7
1
Parent(s):
0e82b94
Adjust the layout
Browse files
app.py
CHANGED
|
@@ -112,12 +112,12 @@ def request_images(raw_text, class_draw, style_draw, batch_size, sr_option):
|
|
| 112 |
raw_text = raw_text + ",国画"
|
| 113 |
url = "http://flagart.baai.ac.cn/api/guohua/"
|
| 114 |
|
| 115 |
-
d = {"data":[raw_text, batch_size, sr_option]}
|
| 116 |
r = requests.post(url, json=d, headers={"Content-Type": "application/json", "Accept": "*/*", "Accept-Encoding": "gzip, deflate, br", "Connection": "keep-alive"})
|
| 117 |
result_text = r.text
|
| 118 |
content = json.loads(result_text)["data"][0]
|
| 119 |
images = []
|
| 120 |
-
for i in range(batch_size):
|
| 121 |
# print(content[i])
|
| 122 |
images.append(base2picture(content[i]))
|
| 123 |
|
|
@@ -302,8 +302,8 @@ if __name__ == "__main__":
|
|
| 302 |
# rounded=(True, True, True, True),
|
| 303 |
# )
|
| 304 |
|
| 305 |
-
text.submit(request_images, inputs=[text, class_draw, style_draw,
|
| 306 |
-
btn.click(request_images, inputs=[text, class_draw, style_draw,
|
| 307 |
# to do here
|
| 308 |
output_txt2img_sr_btn.click(sr_request_images, inputs=[gallery, img_choices], outputs=[sr_gallery])
|
| 309 |
|
|
|
|
| 112 |
raw_text = raw_text + ",国画"
|
| 113 |
url = "http://flagart.baai.ac.cn/api/guohua/"
|
| 114 |
|
| 115 |
+
d = {"data":[raw_text, int(batch_size), sr_option]}
|
| 116 |
r = requests.post(url, json=d, headers={"Content-Type": "application/json", "Accept": "*/*", "Accept-Encoding": "gzip, deflate, br", "Connection": "keep-alive"})
|
| 117 |
result_text = r.text
|
| 118 |
content = json.loads(result_text)["data"][0]
|
| 119 |
images = []
|
| 120 |
+
for i in range(int(batch_size)):
|
| 121 |
# print(content[i])
|
| 122 |
images.append(base2picture(content[i]))
|
| 123 |
|
|
|
|
| 302 |
# rounded=(True, True, True, True),
|
| 303 |
# )
|
| 304 |
|
| 305 |
+
text.submit(request_images, inputs=[text, class_draw, style_draw, sample_size, sr_option], outputs=gallery)
|
| 306 |
+
btn.click(request_images, inputs=[text, class_draw, style_draw, sample_size, sr_option], outputs=gallery)
|
| 307 |
# to do here
|
| 308 |
output_txt2img_sr_btn.click(sr_request_images, inputs=[gallery, img_choices], outputs=[sr_gallery])
|
| 309 |
|