Spaces:
Runtime error
Runtime error
Li
commited on
Commit
•
f533bf3
1
Parent(s):
706df4b
update app.py
Browse files
app.py
CHANGED
@@ -64,7 +64,8 @@ def generate(
|
|
64 |
bad_words_ids = [[b] for b in bad_words_ids]
|
65 |
min_loc_token_id = min(loc_token_ids)
|
66 |
max_loc_token_id = max(loc_token_ids)
|
67 |
-
|
|
|
68 |
width = image.width
|
69 |
height = image.height
|
70 |
image = image.resize((224, 224))
|
@@ -101,6 +102,7 @@ def generate(
|
|
101 |
image_nums=image_nums,
|
102 |
)
|
103 |
box = []
|
|
|
104 |
for o in outputs[0]:
|
105 |
if o >= min_loc_token_id and o <= max_loc_token_id:
|
106 |
box.append(o.item() - min_loc_token_id)
|
|
|
64 |
bad_words_ids = [[b] for b in bad_words_ids]
|
65 |
min_loc_token_id = min(loc_token_ids)
|
66 |
max_loc_token_id = max(loc_token_ids)
|
67 |
+
image_ori = image
|
68 |
+
image = image.convert("RGB")
|
69 |
width = image.width
|
70 |
height = image.height
|
71 |
image = image.resize((224, 224))
|
|
|
102 |
image_nums=image_nums,
|
103 |
)
|
104 |
box = []
|
105 |
+
out_image = image_ori
|
106 |
for o in outputs[0]:
|
107 |
if o >= min_loc_token_id and o <= max_loc_token_id:
|
108 |
box.append(o.item() - min_loc_token_id)
|