Update handler.py
Browse files- handler.py +10 -1
handler.py
CHANGED
@@ -90,7 +90,16 @@ class EndpointHandler:
|
|
90 |
return [{"error": "Missing 'clip' or 'prompt' in input data"}]
|
91 |
|
92 |
# Prepare the inputs for the model
|
93 |
-
inputs_video = self.processor(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
# Generate output from the model
|
96 |
generate_kwargs = {"max_new_tokens": 512, "do_sample": True, "top_p": 0.9}
|
|
|
90 |
return [{"error": "Missing 'clip' or 'prompt' in input data"}]
|
91 |
|
92 |
# Prepare the inputs for the model
|
93 |
+
inputs_video = self.processor(
|
94 |
+
text=prompt,
|
95 |
+
videos=clip,
|
96 |
+
padding=True,
|
97 |
+
return_tensors="pt"
|
98 |
+
).to(self.model.device)
|
99 |
+
|
100 |
+
# Check if 'pixel_values_videos' needs to be renamed to 'pixel_values'
|
101 |
+
if 'pixel_values_videos' in inputs_video:
|
102 |
+
inputs_video['pixel_values'] = inputs_video.pop('pixel_values_videos')
|
103 |
|
104 |
# Generate output from the model
|
105 |
generate_kwargs = {"max_new_tokens": 512, "do_sample": True, "top_p": 0.9}
|