Update handler.py
Browse files- handler.py +2 -4
handler.py
CHANGED
|
@@ -27,13 +27,11 @@ class EndpointHandler:
|
|
| 27 |
self.model = AutoModelForCausalLM.from_pretrained(
|
| 28 |
self.model_name,
|
| 29 |
trust_remote_code=True,
|
| 30 |
-
revision='refs/pr/6'
|
| 31 |
).to(self.device)
|
| 32 |
|
| 33 |
self.processor = AutoProcessor.from_pretrained(
|
| 34 |
self.model_name,
|
| 35 |
trust_remote_code=True,
|
| 36 |
-
revision='refs/pr/6'
|
| 37 |
)
|
| 38 |
|
| 39 |
if torch.cuda.is_available():
|
|
@@ -61,10 +59,10 @@ class EndpointHandler:
|
|
| 61 |
# If inputs is not a dict, assume it's the image path
|
| 62 |
image_path = inputs
|
| 63 |
text_input = "What is in this image?"
|
| 64 |
-
|
| 65 |
# Process image
|
| 66 |
image = self.process_image(image_path) if image_path else None
|
| 67 |
-
|
| 68 |
# Prepare inputs for the model
|
| 69 |
model_inputs = self.processor(
|
| 70 |
images=image if image else None,
|
|
|
|
| 27 |
self.model = AutoModelForCausalLM.from_pretrained(
|
| 28 |
self.model_name,
|
| 29 |
trust_remote_code=True,
|
|
|
|
| 30 |
).to(self.device)
|
| 31 |
|
| 32 |
self.processor = AutoProcessor.from_pretrained(
|
| 33 |
self.model_name,
|
| 34 |
trust_remote_code=True,
|
|
|
|
| 35 |
)
|
| 36 |
|
| 37 |
if torch.cuda.is_available():
|
|
|
|
| 59 |
# If inputs is not a dict, assume it's the image path
|
| 60 |
image_path = inputs
|
| 61 |
text_input = "What is in this image?"
|
| 62 |
+
print("[INFO]",image_path,text_input)
|
| 63 |
# Process image
|
| 64 |
image = self.process_image(image_path) if image_path else None
|
| 65 |
+
print("[INFO]",image)
|
| 66 |
# Prepare inputs for the model
|
| 67 |
model_inputs = self.processor(
|
| 68 |
images=image if image else None,
|