Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -95,7 +95,8 @@ def process_categories() -> tuple:
|
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
-
|
|
|
|
| 99 |
imgs_list = []
|
| 100 |
label_id_to_name, label_id_to_color = process_categories()
|
| 101 |
|
|
@@ -112,13 +113,15 @@ def draw_predictions(boxes, labels, scores, img, score_threshold=0.5):
|
|
| 112 |
boxes=boxes_filtered,
|
| 113 |
labels=[f"{name}: {score:.2f}" for name, score in zip(label_names, scores_filtered)],
|
| 114 |
colors=colors,
|
| 115 |
-
width=
|
|
|
|
| 116 |
)
|
| 117 |
imgs_list.append(img_bbox.permute(1, 2, 0).numpy()) # convert to HWC for Gradio
|
| 118 |
|
| 119 |
return imgs_list
|
| 120 |
|
| 121 |
|
|
|
|
| 122 |
def inference(image_path, model_name, bbox_threshold):
|
| 123 |
transforms = T.Compose([
|
| 124 |
T.SquareResize([1120]),
|
|
|
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
+
|
| 99 |
+
def draw_predictions(boxes, labels, scores, img, score_threshold=0.5, font_size=20):
|
| 100 |
imgs_list = []
|
| 101 |
label_id_to_name, label_id_to_color = process_categories()
|
| 102 |
|
|
|
|
| 113 |
boxes=boxes_filtered,
|
| 114 |
labels=[f"{name}: {score:.2f}" for name, score in zip(label_names, scores_filtered)],
|
| 115 |
colors=colors,
|
| 116 |
+
width=10,
|
| 117 |
+
font_size=30 # increase font size here
|
| 118 |
)
|
| 119 |
imgs_list.append(img_bbox.permute(1, 2, 0).numpy()) # convert to HWC for Gradio
|
| 120 |
|
| 121 |
return imgs_list
|
| 122 |
|
| 123 |
|
| 124 |
+
|
| 125 |
def inference(image_path, model_name, bbox_threshold):
|
| 126 |
transforms = T.Compose([
|
| 127 |
T.SquareResize([1120]),
|