Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -118,9 +118,9 @@ model = BlipForQuestionAnswering.from_pretrained("Salesforce/blip-vqa-base").to(
|
|
| 118 |
# Function
|
| 119 |
def vqa_answer(image, question):
|
| 120 |
# image is already a PIL Image (no need to open again)
|
| 121 |
-
inputs =
|
| 122 |
-
out =
|
| 123 |
-
answer =
|
| 124 |
return answer
|
| 125 |
|
| 126 |
|
|
|
|
| 118 |
# Function
|
| 119 |
def vqa_answer(image, question):
|
| 120 |
# image is already a PIL Image (no need to open again)
|
| 121 |
+
inputs = processor(image, question, return_tensors="pt").to(model.device)
|
| 122 |
+
out = model.generate(**inputs, max_new_tokens=50)
|
| 123 |
+
answer = processor.decode(out[0], skip_special_tokens=True)
|
| 124 |
return answer
|
| 125 |
|
| 126 |
|