Spaces:
Runtime error
Runtime error
Commit
Β·
c333dca
1
Parent(s):
dc09f8c
test input
Browse files
app.py
CHANGED
|
@@ -105,14 +105,15 @@ def deepseek(image, text_input, model_id):
|
|
| 105 |
print(f"{prepare_inputs['sft_format'][0]}", answer)
|
| 106 |
det_pattern = r"<\|det\|>\[\[(.+)]]<\|\/det\|>"
|
| 107 |
|
| 108 |
-
|
| 109 |
-
if
|
| 110 |
return text_input, [], image
|
| 111 |
|
|
|
|
| 112 |
bbox = [ int(v.strip()) for v in det_content.split(",")]
|
| 113 |
#w, h = image.size
|
| 114 |
#bbox = [[bbox[0] * w, bbox[1] * h, bbox[2] * w, bbox[3] * h]]
|
| 115 |
-
|
| 116 |
scaled_boxes = rescale_bounding_boxes([bbox], image.width, image.height)
|
| 117 |
return text_input, scaled_boxes, draw_bounding_boxes(image, scaled_boxes)
|
| 118 |
|
|
|
|
| 105 |
print(f"{prepare_inputs['sft_format'][0]}", answer)
|
| 106 |
det_pattern = r"<\|det\|>\[\[(.+)]]<\|\/det\|>"
|
| 107 |
|
| 108 |
+
det_match = re.search(det_pattern, answer)
|
| 109 |
+
if det_match is None:
|
| 110 |
return text_input, [], image
|
| 111 |
|
| 112 |
+
det_content = det_match.group(1)
|
| 113 |
bbox = [ int(v.strip()) for v in det_content.split(",")]
|
| 114 |
#w, h = image.size
|
| 115 |
#bbox = [[bbox[0] * w, bbox[1] * h, bbox[2] * w, bbox[3] * h]]
|
| 116 |
+
|
| 117 |
scaled_boxes = rescale_bounding_boxes([bbox], image.width, image.height)
|
| 118 |
return text_input, scaled_boxes, draw_bounding_boxes(image, scaled_boxes)
|
| 119 |
|