Spaces:
Running
Running
gokaygokay
commited on
Commit
•
d256f3b
1
Parent(s):
5e123da
Update app.py
Browse files
app.py
CHANGED
@@ -19,6 +19,10 @@ model_id = 'microsoft/Florence-2-large'
|
|
19 |
model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True).eval()
|
20 |
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
|
21 |
|
|
|
|
|
|
|
|
|
22 |
def fig_to_pil(fig):
|
23 |
buf = io.BytesIO()
|
24 |
fig.savefig(buf, format='png')
|
@@ -59,8 +63,7 @@ def plot_bbox(image, data):
|
|
59 |
return fig
|
60 |
|
61 |
def draw_polygons(image, prediction, fill_mask=False):
|
62 |
-
|
63 |
-
'lime','indigo','violet','aqua','magenta','coral','gold','tan','skyblue']
|
64 |
draw = ImageDraw.Draw(image)
|
65 |
scale = 1
|
66 |
for polygons, label in zip(prediction['polygons'], prediction['labels']):
|
|
|
19 |
model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True).eval()
|
20 |
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
|
21 |
|
22 |
+
|
23 |
+
colormap = ['blue','orange','green','purple','brown','pink','gray','olive','cyan','red',
|
24 |
+
'lime','indigo','violet','aqua','magenta','coral','gold','tan','skyblue']
|
25 |
+
|
26 |
def fig_to_pil(fig):
|
27 |
buf = io.BytesIO()
|
28 |
fig.savefig(buf, format='png')
|
|
|
63 |
return fig
|
64 |
|
65 |
def draw_polygons(image, prediction, fill_mask=False):
|
66 |
+
|
|
|
67 |
draw = ImageDraw.Draw(image)
|
68 |
scale = 1
|
69 |
for polygons, label in zip(prediction['polygons'], prediction['labels']):
|