BoyuNLP commited on
Commit
6ddd050
Β·
verified Β·
1 Parent(s): cb99099

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -71,7 +71,7 @@ def crop_image(image_path, click_xy, crop_factor=0.5):
71
  width, height = image.size
72
  crop_width, crop_height = int(width * crop_factor), int(height * crop_factor)
73
 
74
- center_x, center_y = int(click_xy[0] * width), int(click_xy[1] * height)
75
  left = max(center_x - crop_width // 2, 0)
76
  upper = max(center_y - crop_height // 2, 0)
77
  right = min(center_x + crop_width // 2, width)
@@ -134,6 +134,7 @@ def run_showui(image, query, session_id, iterations=1):
134
  )[0]
135
 
136
  click_xy = ast.literal_eval(output_text)
 
137
 
138
  # Draw point on the current image
139
  result_image = draw_point(image_path, click_xy, radius=10)
 
71
  width, height = image.size
72
  crop_width, crop_height = int(width * crop_factor), int(height * crop_factor)
73
 
74
+ center_x, center_y = int(click_xy[0]/1000 * width), int(click_xy[1]/1000 * height)
75
  left = max(center_x - crop_width // 2, 0)
76
  upper = max(center_y - crop_height // 2, 0)
77
  right = min(center_x + crop_width // 2, width)
 
134
  )[0]
135
 
136
  click_xy = ast.literal_eval(output_text)
137
+
138
 
139
  # Draw point on the current image
140
  result_image = draw_point(image_path, click_xy, radius=10)