muhammadsalmanalfaridzi commited on
Commit
0e517e7
·
verified ·
1 Parent(s): 4c664b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -14,7 +14,12 @@ model = get_roboflow_model(model_id=model_id, api_key=api_key)
14
  # Define the callback function for the SAHI slicer
15
  def callback(image_slice: np.ndarray) -> sv.Detections:
16
  # Run inference on the image slice
17
- results = model.infer(image_slice)[0]
 
 
 
 
 
18
  return sv.Detections.from_inference(results)
19
 
20
  # Initialize the SAHI Inference Slicer
 
14
  # Define the callback function for the SAHI slicer
15
  def callback(image_slice: np.ndarray) -> sv.Detections:
16
  # Run inference on the image slice
17
+ results = model.infer(image_slice)
18
+
19
+ # Check if results is a tuple, and if so, access the first element (the detections)
20
+ if isinstance(results, tuple):
21
+ results = results[0] # Extract the detections from the tuple
22
+
23
  return sv.Detections.from_inference(results)
24
 
25
  # Initialize the SAHI Inference Slicer