feat: add translation for image size describe (#2992)

This commit is contained in:
Manuel Schmid 2024-05-24 21:58:17 +02:00 committed by GitHub
parent 7b70d27032
commit 04f64ab0bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 4 deletions

View File

@ -9,9 +9,19 @@
"Advanced": "Advanced",
"Upscale or Variation": "Upscale or Variation",
"Image Prompt": "Image Prompt",
"Inpaint or Outpaint (beta)": "Inpaint or Outpaint (beta)",
"Drag above image to here": "Drag above image to here",
"Inpaint or Outpaint": "Inpaint or Outpaint",
"Drag inpaint or outpaint image to here": "Drag inpaint or outpaint image to here",
"Outpaint Direction": "Outpaint Direction",
"Method": "Method",
"Describe": "Describe",
"Drag any image to here": "Drag any image to here",
"Content Type": "Content Type",
"Photograph": "Photograph",
"Art/Anime": "Art/Anime",
"Describe this Image into Prompt": "Describe this Image into Prompt",
"Image Size and Recommended Size": "Image Size and Recommended Size",
"Upscale or Variation:": "Upscale or Variation:",
"Drag above image to here": "Drag above image to here",
"Disabled": "Disabled",
"Vary (Subtle)": "Vary (Subtle)",
"Vary (Strong)": "Vary (Strong)",

View File

@ -494,7 +494,8 @@ def get_image_size_info(image: np.ndarray, aspect_ratios: list) -> str:
recommended_gcd = math.gcd(recommended_width, recommended_height)
recommended_lcm_ratio = f'{recommended_width // recommended_gcd}:{recommended_height // recommended_gcd}'
size_info += f'\nRecommended Size: {recommended_width} x {recommended_height}, Ratio: {recommended_ratio}, {recommended_lcm_ratio}'
size_info = f'{width} x {height}, {ratio}, {lcm_ratio}'
size_info += f'\n{recommended_width} x {recommended_height}, {recommended_ratio}, {recommended_lcm_ratio}'
return size_info
except Exception as e:

View File

@ -221,7 +221,7 @@ 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)
desc_image_size = gr.Textbox(label='Image Size and Recommended 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):