wangjin2000 commited on
Commit
adb494a
·
verified ·
1 Parent(s): 5921178

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -48,10 +48,10 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu") # Use GPU
48
  model = attempt_load(model_path, device=device) # Placeholder for model loading
49
  model.eval() # Set the model to evaluation mode
50
 
51
- def preprocess_image(image_path):
52
- #def preprocess_image(image):
53
- img0 = cv2.imread(image_path)
54
- #img0 = letterbox(image, 640, stride=32, auto=True)[0] # Resize and pad to 640x640
55
  img = letterbox(img0, 640, stride=32, auto=True)[0] # Resize and pad to 640x640
56
  print("in preprocess:",img.shape)
57
  img = img.transpose(2, 0, 1)[::-1] # Convert BGR to RGB, to 3x416x416
@@ -222,4 +222,3 @@ def build_interface():
222
  if __name__ == '__main__':
223
  demo = build_interface()
224
  demo.launch
225
- '''
 
48
  model = attempt_load(model_path, device=device) # Placeholder for model loading
49
  model.eval() # Set the model to evaluation mode
50
 
51
+ #def preprocess_image(image_path):
52
+ def preprocess_image(image):
53
+ #img0 = cv2.imread(image_path)
54
+ img0 = letterbox(image, 640, stride=32, auto=True)[0] # Resize and pad to 640x640
55
  img = letterbox(img0, 640, stride=32, auto=True)[0] # Resize and pad to 640x640
56
  print("in preprocess:",img.shape)
57
  img = img.transpose(2, 0, 1)[::-1] # Convert BGR to RGB, to 3x416x416
 
222
  if __name__ == '__main__':
223
  demo = build_interface()
224
  demo.launch