Update app.py
Browse files
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)
|
|
|
|
|
|
|
|
|
|
|
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
|