ydshieh
commited on
Commit
•
cb8dbda
1
Parent(s):
bd5c5ff
update
Browse files
app.py
CHANGED
@@ -119,7 +119,7 @@ def draw_entity_boxes_on_image(image, entities, show=False, save_path=None):
|
|
119 |
if show:
|
120 |
pil_image.show()
|
121 |
|
122 |
-
return
|
123 |
|
124 |
|
125 |
def main():
|
@@ -131,6 +131,13 @@ def main():
|
|
131 |
|
132 |
def generate_predictions(image_input, text_input, do_sample, sampling_topp, sampling_temperature):
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
inputs = processor(text=text_input, images=image_input, return_tensors="pt")
|
135 |
|
136 |
generated_ids = model.generate(
|
|
|
119 |
if show:
|
120 |
pil_image.show()
|
121 |
|
122 |
+
return pil_image
|
123 |
|
124 |
|
125 |
def main():
|
|
|
131 |
|
132 |
def generate_predictions(image_input, text_input, do_sample, sampling_topp, sampling_temperature):
|
133 |
|
134 |
+
if text_input == "Brief":
|
135 |
+
text_input = "<grounding>An image of"
|
136 |
+
elif text_input == "Detailed":
|
137 |
+
text_input = "<grounding>Describe this image in detail:"
|
138 |
+
else:
|
139 |
+
text_input = f"<grounding>{text_input}"
|
140 |
+
|
141 |
inputs = processor(text=text_input, images=image_input, return_tensors="pt")
|
142 |
|
143 |
generated_ids = model.generate(
|