mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
2.1.782
2.1.782
This commit is contained in:
@@ -3,7 +3,7 @@ import random
|
||||
import os
|
||||
import time
|
||||
import shared
|
||||
import modules.path
|
||||
import modules.config
|
||||
import fooocus_version
|
||||
import modules.html
|
||||
import modules.async_worker as worker
|
||||
@@ -87,7 +87,7 @@ with shared.gradio_root:
|
||||
prompt = gr.Textbox(show_label=False, placeholder="Type prompt here.", elem_id='positive_prompt',
|
||||
container=False, autofocus=True, elem_classes='type_row', lines=1024)
|
||||
|
||||
default_prompt = modules.path.default_prompt
|
||||
default_prompt = modules.config.default_prompt
|
||||
if isinstance(default_prompt, str) and default_prompt != '':
|
||||
shared.gradio_root.load(lambda: default_prompt, outputs=prompt)
|
||||
|
||||
@@ -112,7 +112,7 @@ with shared.gradio_root:
|
||||
skip_button.click(skip_clicked, queue=False)
|
||||
with gr.Row(elem_classes='advanced_check_row'):
|
||||
input_image_checkbox = gr.Checkbox(label='Input Image', value=False, container=False, elem_classes='min_check')
|
||||
advanced_checkbox = gr.Checkbox(label='Advanced', value=modules.path.default_advanced_checkbox, container=False, elem_classes='min_check')
|
||||
advanced_checkbox = gr.Checkbox(label='Advanced', value=modules.config.default_advanced_checkbox, container=False, elem_classes='min_check')
|
||||
with gr.Row(visible=False) as image_input_panel:
|
||||
with gr.Tabs():
|
||||
with gr.TabItem(label='Upscale or Variation') as uov_tab:
|
||||
@@ -182,16 +182,16 @@ with shared.gradio_root:
|
||||
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)
|
||||
|
||||
with gr.Column(scale=1, visible=modules.path.default_advanced_checkbox) as advanced_column:
|
||||
with gr.Column(scale=1, visible=modules.config.default_advanced_checkbox) as advanced_column:
|
||||
with gr.Tab(label='Setting'):
|
||||
performance_selection = gr.Radio(label='Performance', choices=['Speed', 'Quality'], value='Speed')
|
||||
aspect_ratios_selection = gr.Radio(label='Aspect Ratios', choices=modules.path.available_aspect_ratios,
|
||||
value=modules.path.default_aspect_ratio, info='width × height')
|
||||
image_number = gr.Slider(label='Image Number', minimum=1, maximum=32, step=1, value=modules.path.default_image_number)
|
||||
aspect_ratios_selection = gr.Radio(label='Aspect Ratios', choices=modules.config.available_aspect_ratios,
|
||||
value=modules.config.default_aspect_ratio, info='width × height')
|
||||
image_number = gr.Slider(label='Image Number', minimum=1, maximum=32, 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',
|
||||
value=modules.path.default_prompt_negative)
|
||||
value=modules.config.default_prompt_negative)
|
||||
seed_random = gr.Checkbox(label='Random', value=True)
|
||||
image_seed = gr.Textbox(label='Seed', value=0, max_lines=1, visible=False) # workaround for https://github.com/gradio-app/gradio/issues/5354
|
||||
|
||||
@@ -217,37 +217,37 @@ with shared.gradio_root:
|
||||
with gr.Tab(label='Style'):
|
||||
style_selections = gr.CheckboxGroup(show_label=False, container=False,
|
||||
choices=legal_style_names,
|
||||
value=modules.path.default_styles,
|
||||
value=modules.config.default_styles,
|
||||
label='Image Style')
|
||||
with gr.Tab(label='Model'):
|
||||
with gr.Row():
|
||||
base_model = gr.Dropdown(label='Base Model (SDXL only)', choices=modules.path.model_filenames, value=modules.path.default_base_model_name, show_label=True)
|
||||
refiner_model = gr.Dropdown(label='Refiner (SDXL or SD 1.5)', choices=['None'] + modules.path.model_filenames, value=modules.path.default_refiner_model_name, show_label=True)
|
||||
base_model = gr.Dropdown(label='Base Model (SDXL only)', choices=modules.config.model_filenames, value=modules.config.default_base_model_name, show_label=True)
|
||||
refiner_model = gr.Dropdown(label='Refiner (SDXL or SD 1.5)', choices=['None'] + modules.config.model_filenames, value=modules.config.default_refiner_model_name, show_label=True)
|
||||
|
||||
refiner_switch = gr.Slider(label='Refiner Switch At', minimum=0.1, maximum=1.0, step=0.0001,
|
||||
info='Use 0.4 for SD1.5 realistic models; '
|
||||
'or 0.667 for SD1.5 anime models; '
|
||||
'or 0.8 for XL-refiners; '
|
||||
'or any value for switching two SDXL models.',
|
||||
value=modules.path.default_refiner_switch,
|
||||
visible=modules.path.default_refiner_model_name != 'None')
|
||||
value=modules.config.default_refiner_switch,
|
||||
visible=modules.config.default_refiner_model_name != 'None')
|
||||
|
||||
refiner_model.change(lambda x: gr.update(visible=x != 'None'),
|
||||
inputs=refiner_model, outputs=refiner_switch, show_progress=False, queue=False)
|
||||
|
||||
with gr.Accordion(label='LoRAs', open=True):
|
||||
with gr.Accordion(label='LoRAs (SDXL or SD 1.5)', open=True):
|
||||
lora_ctrls = []
|
||||
for i in range(5):
|
||||
with gr.Row():
|
||||
lora_model = gr.Dropdown(label=f'SDXL LoRA {i+1}', choices=['None'] + modules.path.lora_filenames, value=modules.path.default_lora_name if i == 0 else 'None')
|
||||
lora_weight = gr.Slider(label='Weight', minimum=-2, maximum=2, step=0.01, value=modules.path.default_lora_weight)
|
||||
lora_model = gr.Dropdown(label=f'LoRA {i+1}', choices=['None'] + modules.config.lora_filenames, value=modules.config.default_lora_name if i == 0 else 'None')
|
||||
lora_weight = gr.Slider(label='Weight', minimum=-2, maximum=2, step=0.01, value=modules.config.default_lora_weight)
|
||||
lora_ctrls += [lora_model, lora_weight]
|
||||
with gr.Row():
|
||||
model_refresh = gr.Button(label='Refresh', value='\U0001f504 Refresh All Files', variant='secondary', elem_classes='refresh_button')
|
||||
with gr.Tab(label='Advanced'):
|
||||
sharpness = gr.Slider(label='Sampling Sharpness', minimum=0.0, maximum=30.0, step=0.001, value=modules.path.default_sample_sharpness,
|
||||
sharpness = gr.Slider(label='Sampling Sharpness', minimum=0.0, maximum=30.0, step=0.001, value=modules.config.default_sample_sharpness,
|
||||
info='Higher value means image and texture are sharper.')
|
||||
guidance_scale = gr.Slider(label='Guidance Scale', minimum=1.0, maximum=30.0, step=0.01, value=modules.path.default_cfg_scale,
|
||||
guidance_scale = gr.Slider(label='Guidance Scale', minimum=1.0, maximum=30.0, step=0.01, value=modules.config.default_cfg_scale,
|
||||
info='Higher value means style is cleaner, vivider, and more artistic.')
|
||||
gr.HTML('<a href="https://github.com/lllyasviel/Fooocus/discussions/117" target="_blank">\U0001F4D4 Document</a>')
|
||||
dev_mode = gr.Checkbox(label='Developer Debug Mode', value=False, container=False)
|
||||
@@ -269,10 +269,10 @@ with shared.gradio_root:
|
||||
info='Enabling Fooocus\'s implementation of CFG mimicking for TSNR '
|
||||
'(effective when real CFG > mimicked CFG).')
|
||||
sampler_name = gr.Dropdown(label='Sampler', choices=flags.sampler_list,
|
||||
value=modules.path.default_sampler,
|
||||
value=modules.config.default_sampler,
|
||||
info='Only effective in non-inpaint mode.')
|
||||
scheduler_name = gr.Dropdown(label='Scheduler', choices=flags.scheduler_list,
|
||||
value=modules.path.default_scheduler,
|
||||
value=modules.config.default_scheduler,
|
||||
info='Scheduler of Sampler.')
|
||||
|
||||
generate_image_grid = gr.Checkbox(label='Generate Image Grid for Each Batch',
|
||||
@@ -344,11 +344,11 @@ with shared.gradio_root:
|
||||
dev_mode.change(dev_mode_checked, inputs=[dev_mode], outputs=[dev_tools], queue=False)
|
||||
|
||||
def model_refresh_clicked():
|
||||
modules.path.update_all_model_names()
|
||||
modules.config.update_all_model_names()
|
||||
results = []
|
||||
results += [gr.update(choices=modules.path.model_filenames), gr.update(choices=['None'] + modules.path.model_filenames)]
|
||||
results += [gr.update(choices=modules.config.model_filenames), gr.update(choices=['None'] + modules.config.model_filenames)]
|
||||
for i in range(5):
|
||||
results += [gr.update(choices=['None'] + modules.path.lora_filenames), gr.update()]
|
||||
results += [gr.update(choices=['None'] + modules.config.lora_filenames), gr.update()]
|
||||
return results
|
||||
|
||||
model_refresh.click(model_refresh_clicked, [], [base_model, refiner_model] + lora_ctrls, queue=False)
|
||||
|
||||
Reference in New Issue
Block a user