Spaces:
Running
Running
root
commited on
Commit
·
f2308eb
1
Parent(s):
9664765
Adjust the layout
Browse files- app.py +8 -5
- ui_functions.py +3 -1
app.py
CHANGED
|
@@ -263,7 +263,7 @@ if __name__ == "__main__":
|
|
| 263 |
show_label=True,
|
| 264 |
interactive=True,
|
| 265 |
)
|
| 266 |
-
with gr.Row().style(mobile_collapse=False, equal_height=True):
|
| 267 |
sr_option = gr.Checkbox(value=False, label="是否使用超分(Whether to use super-resolution)")
|
| 268 |
|
| 269 |
gallery = gr.Gallery(
|
|
@@ -277,10 +277,12 @@ if __name__ == "__main__":
|
|
| 277 |
margin=False,
|
| 278 |
rounded=(True, True, True, True),
|
| 279 |
)
|
| 280 |
-
output_txt2img_sr_btn = gr.Button("将选择的图片进行超分").style(
|
| 281 |
margin=False,
|
| 282 |
rounded=(True, True, True, True),
|
| 283 |
)
|
|
|
|
|
|
|
| 284 |
sr_gallery = gr.Gallery(
|
| 285 |
label="SR images", show_label=True, elem_id="sr_gallery"
|
| 286 |
).style(grid=[2], height="auto")
|
|
@@ -341,8 +343,9 @@ if __name__ == "__main__":
|
|
| 341 |
image_mode="RGBA",
|
| 342 |
elem_id="img2img_editor"
|
| 343 |
)
|
| 344 |
-
|
| 345 |
-
|
|
|
|
| 346 |
with gr.TabItem("编辑设置"):
|
| 347 |
with gr.Row():
|
| 348 |
# disable Uncrop for now
|
|
@@ -473,7 +476,7 @@ if __name__ == "__main__":
|
|
| 473 |
output_txt2img_copy_to_input_btn.click(
|
| 474 |
uifn.copy_img_to_input,
|
| 475 |
[gallery, img_choices],
|
| 476 |
-
[tabs, img2img_image_editor, img2img_image_mask],
|
| 477 |
)
|
| 478 |
|
| 479 |
# go_to_img2img_btn.click(
|
|
|
|
| 263 |
show_label=True,
|
| 264 |
interactive=True,
|
| 265 |
)
|
| 266 |
+
with gr.Row().style(mobile_collapse=False, equal_height=True,visible=False):
|
| 267 |
sr_option = gr.Checkbox(value=False, label="是否使用超分(Whether to use super-resolution)")
|
| 268 |
|
| 269 |
gallery = gr.Gallery(
|
|
|
|
| 277 |
margin=False,
|
| 278 |
rounded=(True, True, True, True),
|
| 279 |
)
|
| 280 |
+
output_txt2img_sr_btn = gr.Button("将选择的图片进行超分(super-resolution)").style(
|
| 281 |
margin=False,
|
| 282 |
rounded=(True, True, True, True),
|
| 283 |
)
|
| 284 |
+
move_prompt_zh = gr.Markdown("请移至图生图部分进行编辑(拉到顶部)", visible=False)
|
| 285 |
+
move_prompt_en = gr.Markdown("Please move to the img2img section for editing(Pull to the top)", visible=False)
|
| 286 |
sr_gallery = gr.Gallery(
|
| 287 |
label="SR images", show_label=True, elem_id="sr_gallery"
|
| 288 |
).style(grid=[2], height="auto")
|
|
|
|
| 343 |
image_mode="RGBA",
|
| 344 |
elem_id="img2img_editor"
|
| 345 |
)
|
| 346 |
+
gr.Markdown('请选择一张图像掩盖掉一部分区域,并输入文本描述')
|
| 347 |
+
gr.Markdown('Please select an image to cover up a part of the area and enter a text description.')
|
| 348 |
+
with gr.Tabs(visible=False):
|
| 349 |
with gr.TabItem("编辑设置"):
|
| 350 |
with gr.Row():
|
| 351 |
# disable Uncrop for now
|
|
|
|
| 476 |
output_txt2img_copy_to_input_btn.click(
|
| 477 |
uifn.copy_img_to_input,
|
| 478 |
[gallery, img_choices],
|
| 479 |
+
[tabs, img2img_image_editor, img2img_image_mask, move_prompt_zh, move_prompt_en],
|
| 480 |
)
|
| 481 |
|
| 482 |
# go_to_img2img_btn.click(
|
ui_functions.py
CHANGED
|
@@ -100,7 +100,9 @@ def copy_img_to_input(img, idx):
|
|
| 100 |
processed_image = Image.open(BytesIO(base64.b64decode(image_data)))
|
| 101 |
tab_update = gr.update(selected='img2img_tab')
|
| 102 |
img_update = gr.update(value=processed_image)
|
| 103 |
-
|
|
|
|
|
|
|
| 104 |
except IndexError:
|
| 105 |
return [None, None]
|
| 106 |
|
|
|
|
| 100 |
processed_image = Image.open(BytesIO(base64.b64decode(image_data)))
|
| 101 |
tab_update = gr.update(selected='img2img_tab')
|
| 102 |
img_update = gr.update(value=processed_image)
|
| 103 |
+
move_prompt_zh_update = gr.update(visible=True)
|
| 104 |
+
move_prompt_en_update = gr.update(visible=True)
|
| 105 |
+
return tab_update,processed_image, processed_image, move_prompt_zh_update, move_prompt_en_update
|
| 106 |
except IndexError:
|
| 107 |
return [None, None]
|
| 108 |
|