Spaces:
Running
Running
root
commited on
Commit
·
78393a2
1
Parent(s):
dc4f87a
Front-Back connect test
Browse files
app.py
CHANGED
|
@@ -153,17 +153,23 @@ def img2img(*args):
|
|
| 153 |
else:
|
| 154 |
print(i,type(item))
|
| 155 |
print(item)
|
| 156 |
-
|
|
|
|
| 157 |
|
| 158 |
url = "http://flagart.baai.ac.cn/api/img2img/"
|
| 159 |
d = {"data":args}
|
| 160 |
r = requests.post(url, json=d, headers={"Content-Type": "application/json", "Accept": "*/*", "Accept-Encoding": "gzip, deflate, br", "Connection": "keep-alive"})
|
| 161 |
print(r)
|
| 162 |
result_text = r.text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
# content = json.loads(result_text)
|
| 164 |
-
print(result_text)
|
| 165 |
-
print("服务器已经把东西返回来啦!!!!!!!乌拉乌拉!!!!!")
|
| 166 |
-
return
|
| 167 |
|
| 168 |
|
| 169 |
examples = [
|
|
@@ -435,8 +441,10 @@ if __name__ == "__main__":
|
|
| 435 |
img2img_realesrgan_model_name, img2img_batch_count, img2img_cfg,
|
| 436 |
img2img_denoising, img2img_seed, img2img_height, img2img_width, img2img_resize,
|
| 437 |
img2img_image_mask]
|
| 438 |
-
img2img_outputs = [output_img2img_gallery, output_img2img_seed, output_img2img_params,
|
| 439 |
-
|
|
|
|
|
|
|
| 440 |
|
| 441 |
# If a JobManager was passed in then wrap the Generate functions
|
| 442 |
if img2img_job_ui:
|
|
|
|
| 153 |
else:
|
| 154 |
print(i,type(item))
|
| 155 |
print(item)
|
| 156 |
+
|
| 157 |
+
batch_size = args[8]
|
| 158 |
|
| 159 |
url = "http://flagart.baai.ac.cn/api/img2img/"
|
| 160 |
d = {"data":args}
|
| 161 |
r = requests.post(url, json=d, headers={"Content-Type": "application/json", "Accept": "*/*", "Accept-Encoding": "gzip, deflate, br", "Connection": "keep-alive"})
|
| 162 |
print(r)
|
| 163 |
result_text = r.text
|
| 164 |
+
content = json.loads(result_text)["data"][0]
|
| 165 |
+
images = []
|
| 166 |
+
for i in range(batch_size):
|
| 167 |
+
# print(content[i])
|
| 168 |
+
images.append(base2picture(content[i]))
|
| 169 |
# content = json.loads(result_text)
|
| 170 |
+
# print(result_text)
|
| 171 |
+
# print("服务器已经把东西返回来啦!!!!!!!乌拉乌拉!!!!!")
|
| 172 |
+
return images
|
| 173 |
|
| 174 |
|
| 175 |
examples = [
|
|
|
|
| 441 |
img2img_realesrgan_model_name, img2img_batch_count, img2img_cfg,
|
| 442 |
img2img_denoising, img2img_seed, img2img_height, img2img_width, img2img_resize,
|
| 443 |
img2img_image_mask]
|
| 444 |
+
# img2img_outputs = [output_img2img_gallery, output_img2img_seed, output_img2img_params,
|
| 445 |
+
# output_img2img_stats]
|
| 446 |
+
|
| 447 |
+
img2img_outputs = [output_img2img_gallery]
|
| 448 |
|
| 449 |
# If a JobManager was passed in then wrap the Generate functions
|
| 450 |
if img2img_job_ui:
|