umuthopeyildirim commited on
Commit
5e84664
1 Parent(s): 5112818

Resize image to 640x480

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -81,13 +81,8 @@ with gr.Blocks(css=css) as demo:
81
  def on_submit(image):
82
  original_image = image.copy()
83
 
84
- # Resize the image if it is larger than 640x480
85
- max_width, max_height = 640, 480
86
- h, w = image.shape[:2]
87
- if w > max_width or h > max_height:
88
- scaling_factor = min(max_width / w, max_height / h)
89
- image = cv2.resize(image, None, fx=scaling_factor,
90
- fy=scaling_factor, interpolation=cv2.INTER_AREA)
91
 
92
  # Normalize the image
93
  image = np.asarray(image, dtype=np.float32) / 255.0
 
81
  def on_submit(image):
82
  original_image = image.copy()
83
 
84
+ # Resize the image
85
+ image = cv2.resize(image, (640, 480))
 
 
 
 
 
86
 
87
  # Normalize the image
88
  image = np.asarray(image, dtype=np.float32) / 255.0