Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,18 +23,19 @@ def predict(
|
|
| 23 |
detection_threshold=detection_threshold
|
| 24 |
)
|
| 25 |
return samples[0]["img"], preds[0]
|
| 26 |
-
|
| 27 |
-
def show_preds(input_image):
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
|
|
|
| 38 |
|
| 39 |
# Populate examples in Gradio interface
|
| 40 |
examples = [
|
|
|
|
| 23 |
detection_threshold=detection_threshold
|
| 24 |
)
|
| 25 |
return samples[0]["img"], preds[0]
|
| 26 |
+
|
| 27 |
+
def show_preds(input_image, display_list, detection_threshold):
|
| 28 |
+
display_label = ("Label" in display_list)
|
| 29 |
+
display_bbox = ("BBox" in display_list)
|
| 30 |
+
|
| 31 |
+
if detection_threshold==0: detection_threshold=0.5
|
| 32 |
+
|
| 33 |
+
img, pred = predict(model=model, image=input_image, detection_threshold=detection_threshold)
|
| 34 |
+
# print(pred)
|
| 35 |
+
img = draw_pred(img=img, pred=pred, class_map=class_map, display_label=display_label, display_bbox=display_bbox)
|
| 36 |
+
img = PIL.Image.fromarray(img)
|
| 37 |
+
# print("Output Image: ", img.size, type(img))
|
| 38 |
+
return img
|
| 39 |
|
| 40 |
# Populate examples in Gradio interface
|
| 41 |
examples = [
|