Spaces:
Running
Running
root
commited on
Commit
·
790cace
1
Parent(s):
54b7d8e
fix some bugs
Browse files- app.py +16 -2
- custom.css +0 -20
- ui_functions.py +6 -3
app.py
CHANGED
|
@@ -246,7 +246,16 @@ if __name__ == "__main__":
|
|
| 246 |
label="Generated images", show_label=False, elem_id="gallery"
|
| 247 |
).style(grid=[2], height="auto")
|
| 248 |
|
| 249 |
-
output_txt2img_copy_to_input_btn = gr.Button("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 250 |
|
| 251 |
gr.Examples(examples=examples, fn=request_images, inputs=text, outputs=gallery, examples_per_page=100)
|
| 252 |
text.submit(request_images, inputs=[text, class_draw, style_draw, sample_size, sr_option], outputs=gallery)
|
|
@@ -407,7 +416,7 @@ if __name__ == "__main__":
|
|
| 407 |
img2img_image_mask
|
| 408 |
)
|
| 409 |
|
| 410 |
-
# 把上面这个注释掉下面就不管用了,很神奇无法理解...
|
| 411 |
# output_txt2img_copy_to_input_btn.click(
|
| 412 |
# uifn.copy_img_to_input,
|
| 413 |
# [gallery],
|
|
@@ -421,6 +430,11 @@ if __name__ == "__main__":
|
|
| 421 |
[gallery],
|
| 422 |
[tabs, img2img_image_editor, img2img_image_mask],
|
| 423 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 424 |
|
| 425 |
# 下面这几个函数现在都没什么用
|
| 426 |
output_img2img_copy_to_input_btn.click(
|
|
|
|
| 246 |
label="Generated images", show_label=False, elem_id="gallery"
|
| 247 |
).style(grid=[2], height="auto")
|
| 248 |
|
| 249 |
+
output_txt2img_copy_to_input_btn = gr.Button("发送图片到图生图(Sent the image to img2img)").style(
|
| 250 |
+
margin=False,
|
| 251 |
+
rounded=(True, True, True, True),
|
| 252 |
+
)
|
| 253 |
+
|
| 254 |
+
go_to_img2img_btn = gr.Button("转至图生图(Go to img2img)").style(
|
| 255 |
+
margin=False,
|
| 256 |
+
rounded=(True, True, True, True),
|
| 257 |
+
)
|
| 258 |
+
|
| 259 |
|
| 260 |
gr.Examples(examples=examples, fn=request_images, inputs=text, outputs=gallery, examples_per_page=100)
|
| 261 |
text.submit(request_images, inputs=[text, class_draw, style_draw, sample_size, sr_option], outputs=gallery)
|
|
|
|
| 416 |
img2img_image_mask
|
| 417 |
)
|
| 418 |
|
| 419 |
+
# 把上面这个注释掉下面就不管用了,很神奇无法理解... 后来又好了
|
| 420 |
# output_txt2img_copy_to_input_btn.click(
|
| 421 |
# uifn.copy_img_to_input,
|
| 422 |
# [gallery],
|
|
|
|
| 430 |
[gallery],
|
| 431 |
[tabs, img2img_image_editor, img2img_image_mask],
|
| 432 |
)
|
| 433 |
+
go_to_img2img_btn.click(
|
| 434 |
+
uifn.go_to_img2img,
|
| 435 |
+
[],
|
| 436 |
+
[tabs],
|
| 437 |
+
)
|
| 438 |
|
| 439 |
# 下面这几个函数现在都没什么用
|
| 440 |
output_img2img_copy_to_input_btn.click(
|
custom.css
DELETED
|
@@ -1,20 +0,0 @@
|
|
| 1 |
-
/* Mask background */
|
| 2 |
-
.dark .bg-gray-200{
|
| 3 |
-
background-color:rgba(55, 55, 55, 0.105)!important;
|
| 4 |
-
}
|
| 5 |
-
.cropper-wrap-box, .cropper-canvas{
|
| 6 |
-
background-color:rgba(55, 55, 55, 0.105)!important;
|
| 7 |
-
}
|
| 8 |
-
.cropper-bg {
|
| 9 |
-
background: none!important;
|
| 10 |
-
}
|
| 11 |
-
|
| 12 |
-
select {
|
| 13 |
-
background:#000;
|
| 14 |
-
color:#fff;
|
| 15 |
-
}
|
| 16 |
-
|
| 17 |
-
select * {
|
| 18 |
-
background:#373737ff;
|
| 19 |
-
color:#9c85fb;
|
| 20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ui_functions.py
CHANGED
|
@@ -79,15 +79,18 @@ def copy_img_params_to_lab(params):
|
|
| 79 |
def copy_img_to_input(img):
|
| 80 |
try:
|
| 81 |
# print(img)
|
| 82 |
-
print("=============")
|
| 83 |
-
print("The img type is:{}".format(type(img[0])))
|
| 84 |
image_data = re.sub('^data:image/.+;base64,', '', img[0])
|
| 85 |
processed_image = Image.open(BytesIO(base64.b64decode(image_data)))
|
| 86 |
tab_update = gr.update(selected='img2img_tab')
|
| 87 |
img_update = gr.update(value=processed_image)
|
| 88 |
-
return
|
| 89 |
except IndexError:
|
| 90 |
return [None, None]
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
def copy_img_to_edit(img):
|
| 93 |
try:
|
|
|
|
| 79 |
def copy_img_to_input(img):
|
| 80 |
try:
|
| 81 |
# print(img)
|
| 82 |
+
# print("=============")
|
| 83 |
+
# print("The img type is:{}".format(type(img[0])))
|
| 84 |
image_data = re.sub('^data:image/.+;base64,', '', img[0])
|
| 85 |
processed_image = Image.open(BytesIO(base64.b64decode(image_data)))
|
| 86 |
tab_update = gr.update(selected='img2img_tab')
|
| 87 |
img_update = gr.update(value=processed_image)
|
| 88 |
+
return processed_image, processed_image
|
| 89 |
except IndexError:
|
| 90 |
return [None, None]
|
| 91 |
+
def go_to_img2img():
|
| 92 |
+
tab_update = gr.update(selected='img2img_tab')
|
| 93 |
+
return tab_update
|
| 94 |
|
| 95 |
def copy_img_to_edit(img):
|
| 96 |
try:
|