Spaces:
Sleeping
Sleeping
Update utils/inference.py
Browse files- utils/inference.py +4 -3
utils/inference.py
CHANGED
|
@@ -7,6 +7,8 @@ from utils.tools import format_results, box_prompt, point_prompt, text_prompt
|
|
| 7 |
|
| 8 |
|
| 9 |
def segment_everything(
|
|
|
|
|
|
|
| 10 |
input,
|
| 11 |
input_size=1024,
|
| 12 |
iou_threshold=0.7,
|
|
@@ -18,8 +20,6 @@ def segment_everything(
|
|
| 18 |
wider=False,
|
| 19 |
mask_random_color=True,
|
| 20 |
):
|
| 21 |
-
global model, device
|
| 22 |
-
|
| 23 |
input_size = int(input_size)
|
| 24 |
w, h = input.size
|
| 25 |
scale = input_size / max(w, h)
|
|
@@ -54,6 +54,8 @@ def segment_everything(
|
|
| 54 |
|
| 55 |
|
| 56 |
def segment_with_points(
|
|
|
|
|
|
|
| 57 |
input,
|
| 58 |
input_size=1024,
|
| 59 |
iou_threshold=0.7,
|
|
@@ -65,7 +67,6 @@ def segment_with_points(
|
|
| 65 |
):
|
| 66 |
global global_points
|
| 67 |
global global_point_label
|
| 68 |
-
global model, device
|
| 69 |
|
| 70 |
input_size = int(input_size)
|
| 71 |
w, h = input.size
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
def segment_everything(
|
| 10 |
+
model,
|
| 11 |
+
device,
|
| 12 |
input,
|
| 13 |
input_size=1024,
|
| 14 |
iou_threshold=0.7,
|
|
|
|
| 20 |
wider=False,
|
| 21 |
mask_random_color=True,
|
| 22 |
):
|
|
|
|
|
|
|
| 23 |
input_size = int(input_size)
|
| 24 |
w, h = input.size
|
| 25 |
scale = input_size / max(w, h)
|
|
|
|
| 54 |
|
| 55 |
|
| 56 |
def segment_with_points(
|
| 57 |
+
model,
|
| 58 |
+
device,
|
| 59 |
input,
|
| 60 |
input_size=1024,
|
| 61 |
iou_threshold=0.7,
|
|
|
|
| 67 |
):
|
| 68 |
global global_points
|
| 69 |
global global_point_label
|
|
|
|
| 70 |
|
| 71 |
input_size = int(input_size)
|
| 72 |
w, h = input.size
|