Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,6 +86,9 @@ def generate_caption(image):
|
|
| 86 |
|
| 87 |
inputs = florence_processor(text=prompt, images=image, return_tensors="pt").to(device)
|
| 88 |
|
|
|
|
|
|
|
|
|
|
| 89 |
generated_ids = florence_model.generate(
|
| 90 |
input_ids=inputs["input_ids"],
|
| 91 |
pixel_values=inputs["pixel_values"],
|
|
|
|
| 86 |
|
| 87 |
inputs = florence_processor(text=prompt, images=image, return_tensors="pt").to(device)
|
| 88 |
|
| 89 |
+
# Cast floating-point inputs to match model's dtype (float16)
|
| 90 |
+
inputs["pixel_values"] = inputs["pixel_values"].to(torch.float16)
|
| 91 |
+
|
| 92 |
generated_ids = florence_model.generate(
|
| 93 |
input_ids=inputs["input_ids"],
|
| 94 |
pixel_values=inputs["pixel_values"],
|