Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,6 +32,9 @@ def transcribe_image(image):
|
|
| 32 |
return_tensors="pt"
|
| 33 |
).to(device)
|
| 34 |
|
|
|
|
|
|
|
|
|
|
| 35 |
with torch.inference_mode():
|
| 36 |
output = model.generate(
|
| 37 |
**inputs,
|
|
@@ -67,6 +70,9 @@ def visual_question_answer(image, question):
|
|
| 67 |
return_tensors="pt"
|
| 68 |
).to(device)
|
| 69 |
|
|
|
|
|
|
|
|
|
|
| 70 |
with torch.inference_mode():
|
| 71 |
output = model.generate(
|
| 72 |
**inputs,
|
|
|
|
| 32 |
return_tensors="pt"
|
| 33 |
).to(device)
|
| 34 |
|
| 35 |
+
# FIX: Ensure the image tensor's dtype matches the model's dtype
|
| 36 |
+
inputs["pixel_values"] = inputs["pixel_values"].to(model.dtype)
|
| 37 |
+
|
| 38 |
with torch.inference_mode():
|
| 39 |
output = model.generate(
|
| 40 |
**inputs,
|
|
|
|
| 70 |
return_tensors="pt"
|
| 71 |
).to(device)
|
| 72 |
|
| 73 |
+
# FIX: Ensure the image tensor's dtype matches the model's dtype
|
| 74 |
+
inputs["pixel_values"] = inputs["pixel_values"].to(model.dtype)
|
| 75 |
+
|
| 76 |
with torch.inference_mode():
|
| 77 |
output = model.generate(
|
| 78 |
**inputs,
|