Spaces:
Running
Running
root
commited on
Commit
·
eea90be
1
Parent(s):
668e1df
fixed sr bug
Browse files
app.py
CHANGED
|
@@ -125,7 +125,7 @@ def request_images(raw_text, class_draw, style_draw, batch_size, sr_option, w, h
|
|
| 125 |
|
| 126 |
return images
|
| 127 |
|
| 128 |
-
def sr_request_images(img_str, idx):
|
| 129 |
idx_map = {
|
| 130 |
"图片1(img1)":0,
|
| 131 |
"图片2(img2)":1,
|
|
@@ -136,7 +136,7 @@ def sr_request_images(img_str, idx):
|
|
| 136 |
# image_data = re.sub('^data:image/.+;base64,', '', img_str[idx])
|
| 137 |
image_data = img_str[idx]
|
| 138 |
# print(image_data)
|
| 139 |
-
d = {"data":[image_data, 0, False,
|
| 140 |
url = "http://flagart.baai.ac.cn/api/general/"
|
| 141 |
r = requests.post(url, json=d, headers={"Content-Type": "application/json", "Accept": "*/*", "Accept-Encoding": "gzip, deflate, br", "Connection": "keep-alive"})
|
| 142 |
result_text = r.text
|
|
@@ -315,7 +315,7 @@ if __name__ == "__main__":
|
|
| 315 |
text.submit(request_images, inputs=[text, class_draw, style_draw, sample_size, sr_option, w, h, seed], outputs=gallery)
|
| 316 |
btn.click(request_images, inputs=[text, class_draw, style_draw, sample_size, sr_option, w, h, seed], outputs=gallery)
|
| 317 |
# to do here
|
| 318 |
-
output_txt2img_sr_btn.click(sr_request_images, inputs=[gallery, img_choices], outputs=[sr_gallery])
|
| 319 |
|
| 320 |
sample_size.change(
|
| 321 |
fn=uifn.change_img_choices,
|
|
|
|
| 125 |
|
| 126 |
return images
|
| 127 |
|
| 128 |
+
def sr_request_images(img_str, idx, w, h, seed):
|
| 129 |
idx_map = {
|
| 130 |
"图片1(img1)":0,
|
| 131 |
"图片2(img2)":1,
|
|
|
|
| 136 |
# image_data = re.sub('^data:image/.+;base64,', '', img_str[idx])
|
| 137 |
image_data = img_str[idx]
|
| 138 |
# print(image_data)
|
| 139 |
+
d = {"data":[image_data, 0, False, w, h, seed]} # batch_size设置为0,sr_opt设置为False, 新加了3个参数w,h,seed,随便放就行,进去不会走这个路
|
| 140 |
url = "http://flagart.baai.ac.cn/api/general/"
|
| 141 |
r = requests.post(url, json=d, headers={"Content-Type": "application/json", "Accept": "*/*", "Accept-Encoding": "gzip, deflate, br", "Connection": "keep-alive"})
|
| 142 |
result_text = r.text
|
|
|
|
| 315 |
text.submit(request_images, inputs=[text, class_draw, style_draw, sample_size, sr_option, w, h, seed], outputs=gallery)
|
| 316 |
btn.click(request_images, inputs=[text, class_draw, style_draw, sample_size, sr_option, w, h, seed], outputs=gallery)
|
| 317 |
# to do here
|
| 318 |
+
output_txt2img_sr_btn.click(sr_request_images, inputs=[gallery, img_choices, w, h, seed], outputs=[sr_gallery])
|
| 319 |
|
| 320 |
sample_size.change(
|
| 321 |
fn=uifn.change_img_choices,
|