ManishThota commited on
Commit
e64ccec
·
verified ·
1 Parent(s): 841d820

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -2,8 +2,8 @@
2
 
3
  # gr.load("models/ManishThota/InstructBlip-VQA").launch()
4
 
5
-
6
  from PIL import Image
 
7
  from transformers import BlipProcessor, BlipForQuestionAnswering
8
 
9
  # Initialize the model and processor
@@ -15,7 +15,7 @@ def predict_answer(image, question):
15
  image = image.convert("RGB")
16
 
17
  # Prepare inputs
18
- encoding = processor(image, question, return_tensors="pt").to("cuda:0", torch.float16)
19
 
20
  out = model.generate(**encoding)
21
  generated_text = processor.decode(out[0], skip_special_tokens=True)
 
2
 
3
  # gr.load("models/ManishThota/InstructBlip-VQA").launch()
4
 
 
5
  from PIL import Image
6
+ import torch
7
  from transformers import BlipProcessor, BlipForQuestionAnswering
8
 
9
  # Initialize the model and processor
 
15
  image = image.convert("RGB")
16
 
17
  # Prepare inputs
18
+ encoding = processor(image, question, return_tensors="pt")
19
 
20
  out = model.generate(**encoding)
21
  generated_text = processor.decode(out[0], skip_special_tokens=True)