mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
feat: read size and ratio of an image and provide the recommended size (#2971)
* Add the information about the size and ratio of the read image * feat: use available aspect ratios from config, move function to util, change default visibility of label * refactor: extract sdxl aspect ratios to flags, use in describe as discussed in https://github.com/lllyasviel/Fooocus/pull/2971#discussion_r1608493765 https://github.com/lllyasviel/Fooocus/pull/2971#issuecomment-2123620595 --------- Co-authored-by: Manuel Schmid <dev@mash1t.de> Co-authored-by: Manuel Schmid <9307310+mashb1t@users.noreply.github.com>
This commit is contained in:
co-authored by
Manuel Schmid
Manuel Schmid
parent
7537612bcc
commit
302bfdf855
@@ -221,7 +221,16 @@ with shared.gradio_root:
|
||||
choices=[flags.desc_type_photo, flags.desc_type_anime],
|
||||
value=flags.desc_type_photo)
|
||||
desc_btn = gr.Button(value='Describe this Image into Prompt')
|
||||
desc_image_size = gr.Markdown(label='Image Size', elem_id='desc_image_size', visible=False)
|
||||
gr.HTML('<a href="https://github.com/lllyasviel/Fooocus/discussions/1363" target="_blank">\U0001F4D4 Document</a>')
|
||||
|
||||
def trigger_show_image_properties(image):
|
||||
value = modules.util.get_image_size_info(image, modules.flags.sdxl_aspect_ratios)
|
||||
return gr.update(value=value, visible=True)
|
||||
|
||||
desc_input_image.upload(trigger_show_image_properties, inputs=desc_input_image,
|
||||
outputs=desc_image_size, show_progress=False, queue=False)
|
||||
|
||||
with gr.TabItem(label='Metadata') as load_tab:
|
||||
with gr.Column():
|
||||
metadata_input_image = grh.Image(label='Drag any image generated by Fooocus here', source='upload', type='filepath')
|
||||
@@ -266,7 +275,7 @@ with shared.gradio_root:
|
||||
performance_selection = gr.Radio(label='Performance',
|
||||
choices=flags.Performance.list(),
|
||||
value=modules.config.default_performance)
|
||||
aspect_ratios_selection = gr.Radio(label='Aspect Ratios', choices=modules.config.available_aspect_ratios,
|
||||
aspect_ratios_selection = gr.Radio(label='Aspect Ratios', choices=modules.config.available_aspect_ratios_labels,
|
||||
value=modules.config.default_aspect_ratio, info='width × height',
|
||||
elem_classes='aspect_ratios')
|
||||
image_number = gr.Slider(label='Image Number', minimum=1, maximum=modules.config.default_max_image_number, step=1, value=modules.config.default_image_number)
|
||||
|
||||
Reference in New Issue
Block a user