Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to move toprow to settings #12688

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/shared_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
"localization": OptionInfo("None", "Localization", gr.Dropdown, lambda: {"choices": ["None"] + list(localization.localizations.keys())}, refresh=lambda: localization.list_localizations(cmd_opts.localizations_dir)).needs_reload_ui(),
"gradio_theme": OptionInfo("Default", "Gradio theme", ui_components.DropdownEditable, lambda: {"choices": ["Default"] + shared_gradio_themes.gradio_hf_hub_themes}).info("you can also manually enter any of themes from the <a href='https://huggingface.co/spaces/gradio/theme-gallery'>gallery</a>.").needs_reload_ui(),
"gradio_themes_cache": OptionInfo(True, "Cache gradio themes locally").info("disable to update the selected Gradio theme"),
"move_toprow_to_settings_column": OptionInfo(False, "Move top row (prompt, generate button) to settings column").needs_reload_ui(),
"gallery_height": OptionInfo("", "Gallery height", gr.Textbox).info("an be any valid CSS value").needs_reload_ui(),
"return_grid": OptionInfo(True, "Show grid in results for web"),
"do_not_show_images": OptionInfo(False, "Do not show any images in results for web"),
Expand Down
12 changes: 10 additions & 2 deletions modules/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ def create_ui():
scripts.scripts_txt2img.initialize_scripts(is_img2img=False)

with gr.Blocks(analytics_enabled=False) as txt2img_interface:
toprow = Toprow(is_img2img=False)
if not opts.move_toprow_to_settings_column:
toprow = Toprow(is_img2img=False)

dummy_component = gr.Label(visible=False)

Expand All @@ -335,6 +336,9 @@ def create_ui():

with gr.Tab("Generation", id="txt2img_generation") as txt2img_generation_tab, gr.Row(equal_height=False):
with gr.Column(variant='compact', elem_id="txt2img_settings"):
if opts.move_toprow_to_settings_column:
toprow = Toprow(is_img2img=False)

scripts.scripts_txt2img.prepare_ui()

for category in ordered_ui_categories():
Expand Down Expand Up @@ -544,13 +548,17 @@ def create_ui():
scripts.scripts_img2img.initialize_scripts(is_img2img=True)

with gr.Blocks(analytics_enabled=False) as img2img_interface:
toprow = Toprow(is_img2img=True)
if not opts.move_toprow_to_settings_column:
toprow = Toprow(is_img2img=True)

extra_tabs = gr.Tabs(elem_id="img2img_extra_tabs")
extra_tabs.__enter__()

with gr.Tab("Generation", id="img2img_generation") as img2img_generation_tab, FormRow(equal_height=False):
with gr.Column(variant='compact', elem_id="img2img_settings"):
if opts.move_toprow_to_settings_column:
toprow = Toprow(is_img2img=True)

copy_image_buttons = []
copy_image_destinations = {}

Expand Down