Skip to content

Commit

Permalink
feat: add translation for image size describe (lllyasviel#2992)
Browse files Browse the repository at this point in the history
  • Loading branch information
mashb1t authored and csokun committed Jun 16, 2024
1 parent b5dda55 commit aff1274
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
14 changes: 12 additions & 2 deletions language/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
3 changes: 2 additions & 1 deletion modules/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def ip_advance_checked(x):
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):
Expand Down

0 comments on commit aff1274

Please sign in to comment.