groueix commited on
Commit
2405082
·
1 Parent(s): 29dbdec

fixed ratio

Browse files
Files changed (1) hide show
  1. copaint/gradio_ui.py +3 -3
copaint/gradio_ui.py CHANGED
@@ -76,8 +76,8 @@ def get_canvas_ratio_message(image, h_cells, w_cells):
76
  aspect_ratio = 1/aspect_ratio
77
 
78
  # find nearest aspect ratio in the list of predefined ones
79
- predefined_aspect_ratios = [1/2, 2/3, 1/1, 5/6, 4/5, 5/7]
80
- predefined_aspect_ratios_str = ["1:2", "2:3", "1:1", "5:6", "4:5", "5:7"]
81
  min_diff = float('inf')
82
  closest_ratio_idx = None
83
  for idx, ratio in enumerate(predefined_aspect_ratios):
@@ -111,7 +111,7 @@ def get_canvas_ratio_message(image, h_cells, w_cells):
111
  example_str = " for example, a 12” by 24” canvas."
112
 
113
  return_str = f"You have chosen a <b>{h_cells}x{w_cells} Grid ({h_cells*w_cells} squares)</b>.\n\n"
114
- return_str += f"Preparing your canvas: <b>choose a canvas with a {closest_ratio_str} ratio</b> to respect your design's size ({w}x{h}pixels),{example_str}."
115
  print(f"return_str: {return_str}")
116
  return f"<div style='font-size: 1.2em; line-height: 1.5;'>{return_str}</div>"
117
 
 
76
  aspect_ratio = 1/aspect_ratio
77
 
78
  # find nearest aspect ratio in the list of predefined ones
79
+ predefined_aspect_ratios = [1/3, 1/2, 2/3, 1/1, 5/6, 4/5, 5/7]
80
+ predefined_aspect_ratios_str = ["1:3", "1:2", "2:3", "1:1", "5:6", "4:5", "5:7"]
81
  min_diff = float('inf')
82
  closest_ratio_idx = None
83
  for idx, ratio in enumerate(predefined_aspect_ratios):
 
111
  example_str = " for example, a 12” by 24” canvas."
112
 
113
  return_str = f"You have chosen a <b>{h_cells}x{w_cells} Grid ({h_cells*w_cells} squares)</b>.\n\n"
114
+ return_str += f"Preparing your canvas: <b>choose a canvas with a {closest_ratio_str} ratio</b> to respect your design's size of {w}x{h} pixels,{example_str}"
115
  print(f"return_str: {return_str}")
116
  return f"<div style='font-size: 1.2em; line-height: 1.5;'>{return_str}</div>"
117