comrender commited on
Commit
600be6e
·
verified ·
1 Parent(s): b47d9ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
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"],