Update app.py
Browse files
app.py
CHANGED
@@ -21,15 +21,14 @@ def callback(image_slice: np.ndarray) -> sv.Detections:
|
|
21 |
results = results[0] # Extract the detections from the tuple if necessary
|
22 |
|
23 |
# If the results are a list (likely from Roboflow), access them correctly
|
|
|
24 |
if isinstance(results, list):
|
25 |
-
detections = []
|
26 |
for result in results:
|
27 |
# Ensure each result is processed into a Detections object
|
28 |
detections.extend(sv.Detections.from_inference(result))
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
return sv.Detections.from_inference(results)
|
33 |
|
34 |
# Initialize the SAHI Inference Slicer
|
35 |
slicer = sv.InferenceSlicer(callback=callback)
|
@@ -74,4 +73,4 @@ iface = gr.Interface(
|
|
74 |
)
|
75 |
|
76 |
# Launch the Gradio interface
|
77 |
-
iface.launch()
|
|
|
21 |
results = results[0] # Extract the detections from the tuple if necessary
|
22 |
|
23 |
# If the results are a list (likely from Roboflow), access them correctly
|
24 |
+
detections = []
|
25 |
if isinstance(results, list):
|
|
|
26 |
for result in results:
|
27 |
# Ensure each result is processed into a Detections object
|
28 |
detections.extend(sv.Detections.from_inference(result))
|
29 |
+
|
30 |
+
# Return the list of detections
|
31 |
+
return detections
|
|
|
32 |
|
33 |
# Initialize the SAHI Inference Slicer
|
34 |
slicer = sv.InferenceSlicer(callback=callback)
|
|
|
73 |
)
|
74 |
|
75 |
# Launch the Gradio interface
|
76 |
+
iface.launch()
|