Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,7 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
10 |
model = BlipForQuestionAnswering.from_pretrained("Salesforce/blip-vqa-base").to(device)
|
11 |
processor = AutoProcessor.from_pretrained("Salesforce/blip-vqa-base")
|
12 |
|
|
|
13 |
def answer_question(image, question):
|
14 |
inputs = processor(image, question, return_tensors="pt").to(device)
|
15 |
out = model.generate(**inputs)
|
|
|
10 |
model = BlipForQuestionAnswering.from_pretrained("Salesforce/blip-vqa-base").to(device)
|
11 |
processor = AutoProcessor.from_pretrained("Salesforce/blip-vqa-base")
|
12 |
|
13 |
+
@spaces.GPU
|
14 |
def answer_question(image, question):
|
15 |
inputs = processor(image, question, return_tensors="pt").to(device)
|
16 |
out = model.generate(**inputs)
|