Penthes commited on
Commit
d441cc3
·
verified ·
1 Parent(s): 9ab0011

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -164,19 +164,19 @@ def preprocess_image(image_data):
164
  image = Image.open(io.BytesIO(image_data)).convert('RGB')
165
  w, h = image.size # (width=400, height=296 expected)
166
 
167
- # Define ROI (x1:x2, y1:y2), inclusive indices
168
- X1, X2 = 90, 280
169
- Y1, Y2 = 5, 205
170
 
171
- # Clamp to actual image bounds
172
- X1 = max(0, min(w - 1, X1))
173
- X2 = max(0, min(w - 1, X2))
174
- Y1 = max(0, min(h - 1, Y1))
175
- Y2 = max(0, min(h - 1, Y2))
176
 
177
- # Pillow crop box is (left, upper, right, lower) with right/lower EXCLUSIVE
178
- crop_box = (X1, Y1, X2 + 1, Y2 + 1)
179
- image = image.crop(crop_box)
180
 
181
  # Resize to model input size
182
  image = image.resize((224, 224), Image.BICUBIC)
 
164
  image = Image.open(io.BytesIO(image_data)).convert('RGB')
165
  w, h = image.size # (width=400, height=296 expected)
166
 
167
+ # # Define ROI (x1:x2, y1:y2), inclusive indices
168
+ # X1, X2 = 90, 280
169
+ # Y1, Y2 = 5, 205
170
 
171
+ # # Clamp to actual image bounds
172
+ # X1 = max(0, min(w - 1, X1))
173
+ # X2 = max(0, min(w - 1, X2))
174
+ # Y1 = max(0, min(h - 1, Y1))
175
+ # Y2 = max(0, min(h - 1, Y2))
176
 
177
+ # # Pillow crop box is (left, upper, right, lower) with right/lower EXCLUSIVE
178
+ # crop_box = (X1, Y1, X2 + 1, Y2 + 1)
179
+ # image = image.crop(crop_box)
180
 
181
  # Resize to model input size
182
  image = image.resize((224, 224), Image.BICUBIC)