Spaces:
Sleeping
Sleeping
P01yH3dr0n
commited on
Merge branch 'main' of https://hf-mirror.com/spaces/P01yH3dr0n/client
Browse files- app.py +2 -2
- director_tools.py +5 -5
- images_history.py +1 -1
app.py
CHANGED
@@ -134,7 +134,7 @@ def generate(prompt, quality_tags, neg_prompt, seed, scale, width, height, steps
|
|
134 |
def preview_ui():
|
135 |
with gr.Blocks(css='#preview_image { height: 100%;}'):
|
136 |
image = gr.Image(format='png', elem_id='preview_image', interactive=False, type='filepath', show_share_button=False)
|
137 |
-
send_dtool = gr.Button(value="
|
138 |
image.change(lambda i: gr.Button(visible=False) if i is None else gr.Button(visible=True), inputs=image, outputs=send_dtool)
|
139 |
info = gr.JSON(value={}, label="生成信息")
|
140 |
return image, info, send_dtool
|
@@ -240,7 +240,7 @@ def ui():
|
|
240 |
with gr.Tabs():
|
241 |
with gr.TabItem("图片生成", elem_id="client_ui_main"):
|
242 |
image, paras, others, send_dtool = main_ui()
|
243 |
-
with gr.TabItem("
|
244 |
from_t2i, send_i2i, send_inp, send_vib, in_image, out_image, d_index = director_ui()
|
245 |
with gr.TabItem("图片信息读取"):
|
246 |
png2main, png_items, info, read_image = util_ui()
|
|
|
134 |
def preview_ui():
|
135 |
with gr.Blocks(css='#preview_image { height: 100%;}'):
|
136 |
image = gr.Image(format='png', elem_id='preview_image', interactive=False, type='filepath', show_share_button=False)
|
137 |
+
send_dtool = gr.Button(value="发送到定向修图", visible=False)
|
138 |
image.change(lambda i: gr.Button(visible=False) if i is None else gr.Button(visible=True), inputs=image, outputs=send_dtool)
|
139 |
info = gr.JSON(value={}, label="生成信息")
|
140 |
return image, info, send_dtool
|
|
|
240 |
with gr.Tabs():
|
241 |
with gr.TabItem("图片生成", elem_id="client_ui_main"):
|
242 |
image, paras, others, send_dtool = main_ui()
|
243 |
+
with gr.TabItem("定向修图", elem_id="client_ui_dtool"):
|
244 |
from_t2i, send_i2i, send_inp, send_vib, in_image, out_image, d_index = director_ui()
|
245 |
with gr.TabItem("图片信息读取"):
|
246 |
png2main, png_items, info, read_image = util_ui()
|
director_tools.py
CHANGED
@@ -42,9 +42,9 @@ def director_ui():
|
|
42 |
input_image = gr.Image(label="上传图片", value=None, sources=["upload", "clipboard", "webcam"], interactive=True, type="pil", show_share_button=False)
|
43 |
with gr.Row():
|
44 |
from_t2i = gr.Button("使用文生图上一次生成的图片")
|
45 |
-
from_out = gr.Button("
|
46 |
with gr.Column():
|
47 |
-
output_image = gr.Gallery(format='png', interactive=False, preview=True, show_share_button=False)
|
48 |
selected_index = gr.Number(value=-1, visible=False)
|
49 |
with gr.Row():
|
50 |
send_i2i = gr.Button("发送到图生图")
|
@@ -56,7 +56,7 @@ def director_ui():
|
|
56 |
height = gr.Slider(label="调整高度", value=1024, minimum=1, maximum=2048, step=1)
|
57 |
reset = gr.Button("重置")
|
58 |
with gr.Tab("等比例缩放") as scale:
|
59 |
-
hint = gr.
|
60 |
factor = gr.Slider(label="缩放比例", minimum=0.1, maximum=2, step=0.1)
|
61 |
defry = gr.State(0)
|
62 |
prompt = gr.State('')
|
@@ -89,7 +89,7 @@ def director_ui():
|
|
89 |
tool_btn = gr.Button(value="生成", variant="primary", visible=False)
|
90 |
dtool_stop = gr.Button(value="取消", variant="stop", visible=False)
|
91 |
input_image.change(lambda i: gr.Button(visible=False) if i is None else gr.Button(visible=True), inputs=input_image, outputs=tool_btn)
|
92 |
-
tool_btn.click(lambda: (gr.Button(visible=False), gr.Button(visible=True), gr.Gallery(selected_index=None)), inputs=None, outputs=[tool_btn, dtool_stop, output_image])
|
93 |
dtool_gen = tool_btn.click(augment_image, inputs=[input_image, width, height, req_type, selection, factor, defry, prompt], outputs=output_image, concurrency_id="generate")
|
94 |
dtool_stop.click(lambda: (gr.Button(visible=True), gr.Button(visible=False)), inputs=None, outputs=[tool_btn, dtool_stop], cancels=[dtool_gen])
|
95 |
output_image.change(lambda: (gr.Button(visible=True), gr.Button(visible=False)), inputs=None, outputs=[tool_btn, dtool_stop])
|
@@ -97,6 +97,6 @@ def director_ui():
|
|
97 |
width.change(update_btn_cost, inputs=[width, height, req_type, selection, hint], outputs=tool_btn)
|
98 |
height.change(update_btn_cost, inputs=[width, height, req_type, selection, hint], outputs=tool_btn)
|
99 |
req_type.change(update_btn_cost, inputs=[width, height, req_type, selection, hint], outputs=tool_btn)
|
100 |
-
|
101 |
selection.change(update_btn_cost, inputs=[width, height, req_type, selection, hint], outputs=tool_btn)
|
102 |
return from_t2i, send_i2i, send_inp, send_vib, input_image, output_image, selected_index
|
|
|
42 |
input_image = gr.Image(label="上传图片", value=None, sources=["upload", "clipboard", "webcam"], interactive=True, type="pil", show_share_button=False)
|
43 |
with gr.Row():
|
44 |
from_t2i = gr.Button("使用文生图上一次生成的图片")
|
45 |
+
from_out = gr.Button("使用定向修图上一次生成的图片")
|
46 |
with gr.Column():
|
47 |
+
output_image = gr.Gallery(label="输出图片", format='png', interactive=False, preview=True, show_share_button=False)
|
48 |
selected_index = gr.Number(value=-1, visible=False)
|
49 |
with gr.Row():
|
50 |
send_i2i = gr.Button("发送到图生图")
|
|
|
56 |
height = gr.Slider(label="调整高度", value=1024, minimum=1, maximum=2048, step=1)
|
57 |
reset = gr.Button("重置")
|
58 |
with gr.Tab("等比例缩放") as scale:
|
59 |
+
hint = gr.Textbox('', show_label=False, interactive=False, max_lines=1, container=False)
|
60 |
factor = gr.Slider(label="缩放比例", minimum=0.1, maximum=2, step=0.1)
|
61 |
defry = gr.State(0)
|
62 |
prompt = gr.State('')
|
|
|
89 |
tool_btn = gr.Button(value="生成", variant="primary", visible=False)
|
90 |
dtool_stop = gr.Button(value="取消", variant="stop", visible=False)
|
91 |
input_image.change(lambda i: gr.Button(visible=False) if i is None else gr.Button(visible=True), inputs=input_image, outputs=tool_btn)
|
92 |
+
tool_btn.click(lambda: (gr.Button(visible=False), gr.Button(visible=True), gr.Gallery(selected_index=None), -1), inputs=None, outputs=[tool_btn, dtool_stop, output_image, selected_index])
|
93 |
dtool_gen = tool_btn.click(augment_image, inputs=[input_image, width, height, req_type, selection, factor, defry, prompt], outputs=output_image, concurrency_id="generate")
|
94 |
dtool_stop.click(lambda: (gr.Button(visible=True), gr.Button(visible=False)), inputs=None, outputs=[tool_btn, dtool_stop], cancels=[dtool_gen])
|
95 |
output_image.change(lambda: (gr.Button(visible=True), gr.Button(visible=False)), inputs=None, outputs=[tool_btn, dtool_stop])
|
|
|
97 |
width.change(update_btn_cost, inputs=[width, height, req_type, selection, hint], outputs=tool_btn)
|
98 |
height.change(update_btn_cost, inputs=[width, height, req_type, selection, hint], outputs=tool_btn)
|
99 |
req_type.change(update_btn_cost, inputs=[width, height, req_type, selection, hint], outputs=tool_btn)
|
100 |
+
hint.change(update_btn_cost, inputs=[width, height, req_type, selection, hint], outputs=tool_btn)
|
101 |
selection.change(update_btn_cost, inputs=[width, height, req_type, selection, hint], outputs=tool_btn)
|
102 |
return from_t2i, send_i2i, send_inp, send_vib, input_image, output_image, selected_index
|
images_history.py
CHANGED
@@ -71,7 +71,7 @@ def img_history_ui(tab):
|
|
71 |
history2ref = gr.Button("图片发送到风格迁移", visible=False)
|
72 |
history2i2i = gr.Button("图片发送到图生图", visible=False)
|
73 |
history2inp = gr.Button("图片发送到局部重绘", visible=False)
|
74 |
-
history2dtl = gr.Button("
|
75 |
del_btn = gr.Button('删除', visible=False)
|
76 |
|
77 |
img_dir_path.change(lambda path: get_img_list(path, 1) + ('', None), inputs=img_dir_path, outputs=[history_gallery, page_index, info, items])
|
|
|
71 |
history2ref = gr.Button("图片发送到风格迁移", visible=False)
|
72 |
history2i2i = gr.Button("图片发送到图生图", visible=False)
|
73 |
history2inp = gr.Button("图片发送到局部重绘", visible=False)
|
74 |
+
history2dtl = gr.Button("图片发送到定向修图", visible=False)
|
75 |
del_btn = gr.Button('删除', visible=False)
|
76 |
|
77 |
img_dir_path.change(lambda path: get_img_list(path, 1) + ('', None), inputs=img_dir_path, outputs=[history_gallery, page_index, info, items])
|