merve HF staff commited on
Commit
aabb68d
1 Parent(s): b942818

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -81,7 +81,7 @@ def query(image, confidence_threshold):
81
  inputs = processor(images=image, return_tensors="pt").to(device)
82
  with torch.no_grad():
83
  outputs = model(**inputs)
84
- target_sizes = torch.Tensor([image.size])
85
 
86
  results = processor.post_process_object_detection(outputs=outputs, threshold=confidence_threshold, target_sizes=target_sizes)
87
  return results
 
81
  inputs = processor(images=image, return_tensors="pt").to(device)
82
  with torch.no_grad():
83
  outputs = model(**inputs)
84
+ target_sizes = torch.Tensor([np.array(image).shape[:-1]])
85
 
86
  results = processor.post_process_object_detection(outputs=outputs, threshold=confidence_threshold, target_sizes=target_sizes)
87
  return results