mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
Merge branch 'main_upstream' into hotfix/prevent-skipping-and-stopping-by-other-users
# Conflicts: # webui.py
This commit is contained in:
@@ -190,7 +190,10 @@ with shared.gradio_root:
|
||||
outputs=ip_ad_cols + ip_types + ip_stops + ip_weights,
|
||||
queue=False, show_progress=False)
|
||||
with gr.TabItem(label='Inpaint or Outpaint') as inpaint_tab:
|
||||
inpaint_input_image = grh.Image(label='Drag above image to here', source='upload', type='numpy', tool='sketch', height=500, brush_color="#FFFFFF", elem_id='inpaint_canvas')
|
||||
with gr.Row():
|
||||
inpaint_input_image = grh.Image(label='Drag inpaint or outpaint image to here', source='upload', type='numpy', tool='sketch', height=500, brush_color="#FFFFFF", elem_id='inpaint_canvas')
|
||||
inpaint_mask_image = grh.Image(label='Mask Upload', source='upload', type='numpy', height=500, visible=False)
|
||||
|
||||
with gr.Row():
|
||||
inpaint_additional_prompt = gr.Textbox(placeholder="Describe what you want to inpaint.", elem_id='inpaint_additional_prompt', label='Inpaint Additional Prompt', visible=False)
|
||||
outpaint_selections = gr.CheckboxGroup(choices=['Left', 'Right', 'Top', 'Bottom'], value=[], label='Outpaint Direction')
|
||||
@@ -230,7 +233,7 @@ with shared.gradio_root:
|
||||
aspect_ratios_selection = gr.Radio(label='Aspect Ratios', choices=modules.config.available_aspect_ratios,
|
||||
value=modules.config.default_aspect_ratio, info='width × height',
|
||||
elem_classes='aspect_ratios')
|
||||
image_number = gr.Slider(label='Image Number', minimum=1, maximum=32, step=1, value=modules.config.default_image_number)
|
||||
image_number = gr.Slider(label='Image Number', minimum=1, maximum=modules.config.default_max_image_number, step=1, value=modules.config.default_image_number)
|
||||
negative_prompt = gr.Textbox(label='Negative Prompt', show_label=True, placeholder="Type prompt here.",
|
||||
info='Describing what you do not want to see.', lines=2,
|
||||
elem_id='negative_prompt',
|
||||
@@ -423,7 +426,21 @@ with shared.gradio_root:
|
||||
'Value 1 is same as "Whole Image" in A1111. '
|
||||
'Only used in inpaint, not used in outpaint. '
|
||||
'(Outpaint always use 1.0)')
|
||||
inpaint_ctrls = [debugging_inpaint_preprocessor, inpaint_disable_initial_latent, inpaint_engine, inpaint_strength, inpaint_respective_field]
|
||||
inpaint_erode_or_dilate = gr.Slider(label='Mask Erode or Dilate',
|
||||
minimum=-64, maximum=64, step=1, value=0,
|
||||
info='Positive value will make white area in the mask larger, '
|
||||
'negative value will make white area smaller.'
|
||||
'(default is 0, always process before any mask invert)')
|
||||
inpaint_mask_upload_checkbox = gr.Checkbox(label='Enable Mask Upload', value=False)
|
||||
invert_mask_checkbox = gr.Checkbox(label='Invert Mask', value=False)
|
||||
|
||||
inpaint_ctrls = [debugging_inpaint_preprocessor, inpaint_disable_initial_latent, inpaint_engine,
|
||||
inpaint_strength, inpaint_respective_field,
|
||||
inpaint_mask_upload_checkbox, invert_mask_checkbox, inpaint_erode_or_dilate]
|
||||
|
||||
inpaint_mask_upload_checkbox.change(lambda x: gr.update(visible=x),
|
||||
inputs=inpaint_mask_upload_checkbox,
|
||||
outputs=inpaint_mask_image, queue=False, show_progress=False)
|
||||
|
||||
with gr.Tab(label='FreeU'):
|
||||
freeu_enabled = gr.Checkbox(label='Enabled', value=False)
|
||||
@@ -514,10 +531,12 @@ with shared.gradio_root:
|
||||
ctrls += [base_model, refiner_model, refiner_switch] + lora_ctrls
|
||||
ctrls += [input_image_checkbox, current_tab]
|
||||
ctrls += [uov_method, uov_input_image]
|
||||
ctrls += [outpaint_selections, inpaint_input_image, inpaint_additional_prompt]
|
||||
ctrls += [outpaint_selections, inpaint_input_image, inpaint_additional_prompt, inpaint_mask_image]
|
||||
ctrls += ip_ctrls
|
||||
|
||||
def parse_meta(raw_prompt_txt):
|
||||
state_is_generating = gr.State(False)
|
||||
|
||||
def parse_meta(raw_prompt_txt, is_generating):
|
||||
loaded_json = None
|
||||
try:
|
||||
if '{' in raw_prompt_txt:
|
||||
@@ -529,13 +548,16 @@ with shared.gradio_root:
|
||||
loaded_json = None
|
||||
|
||||
if loaded_json is None:
|
||||
return gr.update(), gr.update(visible=True), gr.update(visible=False)
|
||||
if is_generating:
|
||||
return gr.update(), gr.update(), gr.update()
|
||||
else:
|
||||
return gr.update(), gr.update(visible=True), gr.update(visible=False)
|
||||
|
||||
return json.dumps(loaded_json), gr.update(visible=False), gr.update(visible=True)
|
||||
|
||||
prompt.input(parse_meta, inputs=prompt, outputs=[prompt, generate_button, load_parameter_button], queue=False, show_progress=False)
|
||||
prompt.input(parse_meta, inputs=[prompt, state_is_generating], outputs=[prompt, generate_button, load_parameter_button], queue=False, show_progress=False)
|
||||
|
||||
load_parameter_button.click(modules.meta_parser.load_parameter_button_click, inputs=prompt, outputs=[
|
||||
load_parameter_button.click(modules.meta_parser.load_parameter_button_click, inputs=[prompt, state_is_generating], outputs=[
|
||||
advanced_checkbox,
|
||||
image_number,
|
||||
prompt,
|
||||
@@ -561,12 +583,14 @@ with shared.gradio_root:
|
||||
load_parameter_button
|
||||
] + lora_ctrls, queue=False, show_progress=False)
|
||||
|
||||
generate_button.click(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=True, interactive=True), gr.update(visible=False), []), outputs=[stop_button, skip_button, generate_button, gallery]) \
|
||||
generate_button.click(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=True, interactive=True), gr.update(visible=False, interactive=False), [], True),
|
||||
outputs=[stop_button, skip_button, generate_button, gallery, state_is_generating]) \
|
||||
.then(fn=refresh_seed, inputs=[seed_random, image_seed], outputs=image_seed) \
|
||||
.then(advanced_parameters.set_all_advanced_parameters, inputs=adps) \
|
||||
.then(fn=get_task, inputs=ctrls, outputs=currentTask) \
|
||||
.then(fn=generate_clicked, inputs=currentTask, outputs=[progress_html, progress_window, progress_gallery, gallery]) \
|
||||
.then(lambda: (gr.update(visible=True), gr.update(visible=False), gr.update(visible=False)), outputs=[generate_button, stop_button, skip_button]) \
|
||||
.then(fn=generate_clicked, inputs=ctrls, outputs=[progress_html, progress_window, progress_gallery, gallery]) \
|
||||
.then(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=False, interactive=False), gr.update(visible=False, interactive=False), False),
|
||||
outputs=[generate_button, stop_button, skip_button, state_is_generating]) \
|
||||
.then(fn=lambda: None, _js='playNotification').then(fn=lambda: None, _js='refresh_grid_delayed')
|
||||
|
||||
for notification_file in ['notification.ogg', 'notification.mp3']:
|
||||
@@ -584,7 +608,7 @@ with shared.gradio_root:
|
||||
return mode, ["Fooocus V2"]
|
||||
|
||||
desc_btn.click(trigger_describe, inputs=[desc_method, desc_input_image],
|
||||
outputs=[prompt, style_selections], show_progress=True, queue=False)
|
||||
outputs=[prompt, style_selections], show_progress=True, queue=True)
|
||||
|
||||
|
||||
def dump_default_english_config():
|
||||
|
||||
Reference in New Issue
Block a user