Spaces:
Running
Running
root
commited on
Commit
·
450482a
1
Parent(s):
d7755cb
add img choice
Browse files- app.py +1 -1
- ui_functions.py +6 -0
app.py
CHANGED
|
@@ -247,7 +247,7 @@ if __name__ == "__main__":
|
|
| 247 |
).style(grid=[2], height="auto")
|
| 248 |
|
| 249 |
with gr.Row().style(mobile_collapse=False, equal_height=True):
|
| 250 |
-
img_choices = gr.Dropdown(["图片1(img1)"],label='请选择一张图片发送到图生图',show_label=True,value="图片1(img1)"
|
| 251 |
output_txt2img_copy_to_input_btn = gr.Button("发送图片到图生图(Sent the image to img2img)").style(
|
| 252 |
margin=False,
|
| 253 |
rounded=(True, True, True, True),
|
|
|
|
| 247 |
).style(grid=[2], height="auto")
|
| 248 |
|
| 249 |
with gr.Row().style(mobile_collapse=False, equal_height=True):
|
| 250 |
+
img_choices = gr.Dropdown(["图片1(img1)"],label='请选择一张图片发送到图生图',show_label=True,value="图片1(img1)")
|
| 251 |
output_txt2img_copy_to_input_btn = gr.Button("发送图片到图生图(Sent the image to img2img)").style(
|
| 252 |
margin=False,
|
| 253 |
rounded=(True, True, True, True),
|
ui_functions.py
CHANGED
|
@@ -89,6 +89,12 @@ def copy_img_to_input(img, idx):
|
|
| 89 |
# print(img)
|
| 90 |
# print("=============")
|
| 91 |
# print("The img type is:{}".format(type(img[0])))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
image_data = re.sub('^data:image/.+;base64,', '', img[idx])
|
| 93 |
processed_image = Image.open(BytesIO(base64.b64decode(image_data)))
|
| 94 |
tab_update = gr.update(selected='img2img_tab')
|
|
|
|
| 89 |
# print(img)
|
| 90 |
# print("=============")
|
| 91 |
# print("The img type is:{}".format(type(img[0])))
|
| 92 |
+
idx_map = {
|
| 93 |
+
"图片1(img1)":0,
|
| 94 |
+
"图片2(img2)":1,
|
| 95 |
+
"图片3(img4)":2,
|
| 96 |
+
"图片4(img5)":3,
|
| 97 |
+
}
|
| 98 |
image_data = re.sub('^data:image/.+;base64,', '', img[idx])
|
| 99 |
processed_image = Image.open(BytesIO(base64.b64decode(image_data)))
|
| 100 |
tab_update = gr.update(selected='img2img_tab')
|