mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
Merge remote-tracking branch 'upstream/main' into feature/add-advanced-parameter-disable-intermediate-images
This commit is contained in:
@@ -22,7 +22,7 @@ from modules.auth import auth_enabled, check_auth
|
||||
|
||||
|
||||
def generate_clicked(*args):
|
||||
import fcbh.model_management as model_management
|
||||
import ldm_patched.modules.model_management as model_management
|
||||
|
||||
with model_management.interrupt_processing_mutex:
|
||||
model_management.interrupt_processing = False
|
||||
@@ -113,13 +113,13 @@ with shared.gradio_root:
|
||||
stop_button = gr.Button(label="Stop", value="Stop", elem_classes='type_row_half', elem_id='stop_button', visible=False)
|
||||
|
||||
def stop_clicked():
|
||||
import fcbh.model_management as model_management
|
||||
import ldm_patched.modules.model_management as model_management
|
||||
shared.last_stop = 'stop'
|
||||
model_management.interrupt_current_processing()
|
||||
return [gr.update(interactive=False)] * 2
|
||||
|
||||
def skip_clicked():
|
||||
import fcbh.model_management as model_management
|
||||
import ldm_patched.modules.model_management as model_management
|
||||
shared.last_stop = 'skip'
|
||||
model_management.interrupt_current_processing()
|
||||
return
|
||||
@@ -182,7 +182,6 @@ with shared.gradio_root:
|
||||
ip_advanced.change(ip_advance_checked, inputs=ip_advanced,
|
||||
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():
|
||||
@@ -192,7 +191,17 @@ with shared.gradio_root:
|
||||
example_inpaint_prompts = gr.Dataset(samples=modules.config.example_inpaint_prompts, label='Additional Prompt Quick List', components=[inpaint_additional_prompt], visible=False)
|
||||
gr.HTML('* Powered by Fooocus Inpaint Engine <a href="https://github.com/lllyasviel/Fooocus/discussions/414" target="_blank">\U0001F4D4 Document</a>')
|
||||
example_inpaint_prompts.click(lambda x: x[0], inputs=example_inpaint_prompts, outputs=inpaint_additional_prompt, show_progress=False, queue=False)
|
||||
|
||||
with gr.TabItem(label='Describe') as desc_tab:
|
||||
with gr.Row():
|
||||
with gr.Column():
|
||||
desc_input_image = grh.Image(label='Drag any image to here', source='upload', type='numpy')
|
||||
with gr.Column():
|
||||
desc_method = gr.Radio(
|
||||
label='Content Type',
|
||||
choices=[flags.desc_type_photo, flags.desc_type_anime],
|
||||
value=flags.desc_type_photo)
|
||||
desc_btn = gr.Button(value='Describe this Image into Prompt')
|
||||
gr.HTML('<a href="https://github.com/lllyasviel/Fooocus/discussions/1363" target="_blank">\U0001F4D4 Document</a>')
|
||||
switch_js = "(x) => {if(x){viewer_to_bottom(100);viewer_to_bottom(500);}else{viewer_to_top();} return x;}"
|
||||
down_js = "() => {viewer_to_bottom();}"
|
||||
|
||||
@@ -204,6 +213,7 @@ with shared.gradio_root:
|
||||
uov_tab.select(lambda: 'uov', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
||||
inpaint_tab.select(lambda: 'inpaint', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
||||
ip_tab.select(lambda: 'ip', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
||||
desc_tab.select(lambda: 'desc', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
||||
|
||||
with gr.Column(scale=1, visible=modules.config.default_advanced_checkbox) as advanced_column:
|
||||
with gr.Tab(label='Setting'):
|
||||
@@ -445,12 +455,13 @@ with shared.gradio_root:
|
||||
model_refresh.click(model_refresh_clicked, [], [base_model, refiner_model] + lora_ctrls,
|
||||
queue=False, show_progress=False)
|
||||
|
||||
performance_selection.change(lambda x: [gr.update(interactive=x != 'Extreme Speed')] * 11,
|
||||
performance_selection.change(lambda x: [gr.update(interactive=x != 'Extreme Speed')] * 11 +
|
||||
[gr.update(visible=x != 'Extreme Speed')] * 1,
|
||||
inputs=performance_selection,
|
||||
outputs=[
|
||||
guidance_scale, sharpness, adm_scaler_end, adm_scaler_positive,
|
||||
adm_scaler_negative, refiner_switch, refiner_model, sampler_name,
|
||||
scheduler_name, adaptive_cfg, refiner_swap_method
|
||||
scheduler_name, adaptive_cfg, refiner_swap_method, negative_prompt
|
||||
], queue=False, show_progress=False)
|
||||
|
||||
advanced_checkbox.change(lambda x: gr.update(visible=x), advanced_checkbox, advanced_column,
|
||||
@@ -513,6 +524,18 @@ with shared.gradio_root:
|
||||
gr.Audio(interactive=False, value=notification_file, elem_id='audio_notification', visible=False)
|
||||
break
|
||||
|
||||
def trigger_describe(mode, img):
|
||||
if mode == flags.desc_type_photo:
|
||||
from extras.interrogate import default_interrogator as default_interrogator_photo
|
||||
return default_interrogator_photo(img), ["Fooocus V2", "Fooocus Enhance", "Fooocus Sharp"]
|
||||
if mode == flags.desc_type_anime:
|
||||
from extras.wd14tagger import default_interrogator as default_interrogator_anime
|
||||
return default_interrogator_anime(img), ["Fooocus V2", "Fooocus Masterpiece"]
|
||||
return mode, ["Fooocus V2"]
|
||||
|
||||
desc_btn.click(trigger_describe, inputs=[desc_method, desc_input_image],
|
||||
outputs=[prompt, style_selections], show_progress=True, queue=False)
|
||||
|
||||
|
||||
def dump_default_english_config():
|
||||
from modules.localization import dump_english_config
|
||||
@@ -522,7 +545,7 @@ def dump_default_english_config():
|
||||
# dump_default_english_config()
|
||||
|
||||
shared.gradio_root.launch(
|
||||
inbrowser=args_manager.args.auto_launch,
|
||||
inbrowser=args_manager.args.in_browser,
|
||||
server_name=args_manager.args.listen,
|
||||
server_port=args_manager.args.port,
|
||||
share=args_manager.args.share,
|
||||
|
||||
Reference in New Issue
Block a user