Spaces:
Running
on
Zero
Running
on
Zero
markany-yhkwon
commited on
Commit
·
e4ed59a
1
Parent(s):
28ec218
i love cpu
Browse files
app.py
CHANGED
@@ -31,7 +31,7 @@ ckpt_repo_id = "ShilongLiu/GroundingDINO"
|
|
31 |
ckpt_filenmae = "groundingdino_swinb_cogcoor.pth"
|
32 |
|
33 |
|
34 |
-
def load_model_hf(model_config_path, repo_id, filename, device='
|
35 |
args = SLConfig.fromfile(model_config_path)
|
36 |
model = build_model(args)
|
37 |
args.device = device
|
@@ -75,7 +75,7 @@ def run_grounding(input_image, grounding_caption, box_threshold, text_threshold)
|
|
75 |
image_pil: Image = image_transform_grounding_for_vis(init_image)
|
76 |
|
77 |
# run grounidng
|
78 |
-
boxes, logits, phrases = predict(model, image_tensor, grounding_caption, box_threshold, text_threshold, device='
|
79 |
annotated_frame = annotate(image_source=np.asarray(image_pil), boxes=boxes, logits=logits, phrases=phrases)
|
80 |
image_with_box = Image.fromarray(cv2.cvtColor(annotated_frame, cv2.COLOR_BGR2RGB))
|
81 |
|
|
|
31 |
ckpt_filenmae = "groundingdino_swinb_cogcoor.pth"
|
32 |
|
33 |
|
34 |
+
def load_model_hf(model_config_path, repo_id, filename, device='cpu'):
|
35 |
args = SLConfig.fromfile(model_config_path)
|
36 |
model = build_model(args)
|
37 |
args.device = device
|
|
|
75 |
image_pil: Image = image_transform_grounding_for_vis(init_image)
|
76 |
|
77 |
# run grounidng
|
78 |
+
boxes, logits, phrases = predict(model, image_tensor, grounding_caption, box_threshold, text_threshold, device='cpu')
|
79 |
annotated_frame = annotate(image_source=np.asarray(image_pil), boxes=boxes, logits=logits, phrases=phrases)
|
80 |
image_with_box = Image.fromarray(cv2.cvtColor(annotated_frame, cv2.COLOR_BGR2RGB))
|
81 |
|