Spaces:
Paused
Paused
P01yH3dr0n
commited on
Commit
•
7f794a3
1
Parent(s):
42e59f2
Update app.py
Browse files
app.py
CHANGED
@@ -67,12 +67,13 @@ def control_ui():
|
|
67 |
ref_image = gr.Image(label="上传图片", value=None, sources=["upload"], interactive=True, type="pil")
|
68 |
info_extract = gr.Slider(label='参考信息提取', value=1, minimum=0, maximum=1, step=0.1)
|
69 |
ref_str = gr.Slider(label='参考强度', value=0.6, minimum=0, maximum=1, step=0.1)
|
70 |
-
|
71 |
with gr.Accordion('蒙版重绘', open=False):
|
72 |
with gr.Row():
|
73 |
use_inp = gr.Checkbox(label='启用', value=False)
|
74 |
overlay = gr.Checkbox(label='覆盖原图', value=True)
|
75 |
inp_img = gr.ImageEditor(label="上传图片", value=None, sources=["upload"], interactive=True, type="pil", eraser=False, transforms=None, brush="imagemask")
|
|
|
76 |
with gr.Column():
|
77 |
gr.Textbox(value=get_count, label='Usage count', every=10)
|
78 |
save = gr.Checkbox(value=True, label='Always save all generated images')
|
@@ -81,7 +82,7 @@ def control_ui():
|
|
81 |
rand_seed.click(fn=lambda: -1, inputs=None, outputs=seed)
|
82 |
width.change(lambda w, h: h if w*h<=1024*1024 else (1024*1024//w//64)*64, [width, height], height)
|
83 |
height.change(lambda w, h: w if w*h<=1024*1024 else (1024*1024//h//64)*64, [width, height], width)
|
84 |
-
return gen_btn,[prompt, quality_tags, neg_prompt, seed, scale, width, height, steps, sampler, scheduler, smea, dyn, dyn_threshold, cfg_rescale, ref_image, info_extract, ref_str, inp_img, overlay], [save, rand_seed, reuse_seed,
|
85 |
|
86 |
|
87 |
def generate(prompt, quality_tags, neg_prompt, seed, scale, width, height, steps, sampler, scheduler, smea, dyn, dyn_threshold, cfg_rescale, ref_image, info_extract, ref_str, inp_img, overlay, save, use_inp):
|
@@ -118,6 +119,7 @@ def main_ui():
|
|
118 |
gen_btn.click(generate, paras + [others[0], others[4]], [image, info])
|
119 |
others[2].click(lambda o, s: o if len(s) == 0 else s['parameters']['seed'], inputs=[paras[3], info], outputs=paras[3])
|
120 |
others[3].click(lambda i: i, inputs=image, outputs=paras[14])
|
|
|
121 |
return page, paras
|
122 |
|
123 |
|
|
|
67 |
ref_image = gr.Image(label="上传图片", value=None, sources=["upload"], interactive=True, type="pil")
|
68 |
info_extract = gr.Slider(label='参考信息提取', value=1, minimum=0, maximum=1, step=0.1)
|
69 |
ref_str = gr.Slider(label='参考强度', value=0.6, minimum=0, maximum=1, step=0.1)
|
70 |
+
reuse_img_vibe = gr.Button(value='使用上一次生成的图片')
|
71 |
with gr.Accordion('蒙版重绘', open=False):
|
72 |
with gr.Row():
|
73 |
use_inp = gr.Checkbox(label='启用', value=False)
|
74 |
overlay = gr.Checkbox(label='覆盖原图', value=True)
|
75 |
inp_img = gr.ImageEditor(label="上传图片", value=None, sources=["upload"], interactive=True, type="pil", eraser=False, transforms=None, brush="imagemask")
|
76 |
+
reuse_img_inp = gr.Button(value='使用上一次生成的图片')
|
77 |
with gr.Column():
|
78 |
gr.Textbox(value=get_count, label='Usage count', every=10)
|
79 |
save = gr.Checkbox(value=True, label='Always save all generated images')
|
|
|
82 |
rand_seed.click(fn=lambda: -1, inputs=None, outputs=seed)
|
83 |
width.change(lambda w, h: h if w*h<=1024*1024 else (1024*1024//w//64)*64, [width, height], height)
|
84 |
height.change(lambda w, h: w if w*h<=1024*1024 else (1024*1024//h//64)*64, [width, height], width)
|
85 |
+
return gen_btn,[prompt, quality_tags, neg_prompt, seed, scale, width, height, steps, sampler, scheduler, smea, dyn, dyn_threshold, cfg_rescale, ref_image, info_extract, ref_str, inp_img, overlay], [save, rand_seed, reuse_seed, reuse_img_vibe, reuse_img_inp, use_inp]
|
86 |
|
87 |
|
88 |
def generate(prompt, quality_tags, neg_prompt, seed, scale, width, height, steps, sampler, scheduler, smea, dyn, dyn_threshold, cfg_rescale, ref_image, info_extract, ref_str, inp_img, overlay, save, use_inp):
|
|
|
119 |
gen_btn.click(generate, paras + [others[0], others[4]], [image, info])
|
120 |
others[2].click(lambda o, s: o if len(s) == 0 else s['parameters']['seed'], inputs=[paras[3], info], outputs=paras[3])
|
121 |
others[3].click(lambda i: i, inputs=image, outputs=paras[14])
|
122 |
+
others[4].click(lambda i: i, inputs=image, outputs=paras[17])
|
123 |
return page, paras
|
124 |
|
125 |
|