Yan
commited on
Commit
·
8268f49
1
Parent(s):
226d5bb
added text inputs to enable customization for prompting
Browse files- handler.py +5 -2
handler.py
CHANGED
@@ -192,8 +192,11 @@ class EndpointHandler():
|
|
192 |
|
193 |
# This might give different results from the original argument `image_input`
|
194 |
image_input = Image.open(user_image_path)
|
195 |
-
text_input = "
|
196 |
-
|
|
|
|
|
|
|
197 |
|
198 |
inputs = self.processor(text=text_input, images=image_input, return_tensors="pt")
|
199 |
|
|
|
192 |
|
193 |
# This might give different results from the original argument `image_input`
|
194 |
image_input = Image.open(user_image_path)
|
195 |
+
text_input = data.pop("inputs", None)
|
196 |
+
if not text_input:
|
197 |
+
text_input = "<grounding>Describe this image in detail:"
|
198 |
+
else:
|
199 |
+
text_input = f"<grounding>{text_input}"
|
200 |
|
201 |
inputs = self.processor(text=text_input, images=image_input, return_tensors="pt")
|
202 |
|