Spaces:
Paused
Paused
Commit
·
771fc5c
1
Parent(s):
4aa9a25
Update app.py
Browse files
app.py
CHANGED
|
@@ -563,18 +563,22 @@ def run_anything_task(input_image, text_prompt, box_threshold, text_threshold,
|
|
| 563 |
# color = np.array([30/255, 144/255, 255/255, 0.6])
|
| 564 |
show_mask(mask.cpu().numpy(), plt.gca(), color)
|
| 565 |
label, score = parse_label_and_score(pred_phrases[i])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 566 |
item = {
|
| 567 |
"id": i,
|
| 568 |
-
|
| 569 |
"label": label,
|
| 570 |
"score": score,
|
| 571 |
-
"color": color
|
| 572 |
}
|
| 573 |
-
print("label: " + label)
|
| 574 |
results.append(item)
|
| 575 |
|
| 576 |
-
for box, label in zip(boxes_filt, pred_phrases):
|
| 577 |
-
|
| 578 |
plt.axis('off')
|
| 579 |
image_path = os.path.join(output_dir, f"grounding_seg_output_{file_temp}.png")
|
| 580 |
plt.savefig(image_path, bbox_inches="tight")
|
|
|
|
| 563 |
# color = np.array([30/255, 144/255, 255/255, 0.6])
|
| 564 |
show_mask(mask.cpu().numpy(), plt.gca(), color)
|
| 565 |
label, score = parse_label_and_score(pred_phrases[i])
|
| 566 |
+
print("id: " + str(i))
|
| 567 |
+
print("box: " + str(boxes_filt[i].tolist()))
|
| 568 |
+
print("label: " + label)
|
| 569 |
+
print("score: " + str(score))
|
| 570 |
+
print("color: " + str(color.tolist()))
|
| 571 |
item = {
|
| 572 |
"id": i,
|
| 573 |
+
"box": str(boxes_filt[i].tolist()),
|
| 574 |
"label": label,
|
| 575 |
"score": score,
|
| 576 |
+
"color": str(color.tolist())
|
| 577 |
}
|
|
|
|
| 578 |
results.append(item)
|
| 579 |
|
| 580 |
+
#for box, label in zip(boxes_filt, pred_phrases):
|
| 581 |
+
# show_box(box.cpu().numpy(), plt.gca(), label)
|
| 582 |
plt.axis('off')
|
| 583 |
image_path = os.path.join(output_dir, f"grounding_seg_output_{file_temp}.png")
|
| 584 |
plt.savefig(image_path, bbox_inches="tight")
|