Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,9 @@ import torch
|
|
5 |
torch.hub.download_url_to_file('http://images.cocodataset.org/val2017/000000039769.jpg', 'cats.jpg')
|
6 |
torch.hub.download_url_to_file('https://cdn.openai.com/dall-e-2/demos/text2im/astronaut/horse/photo/0.jpg', 'astronaut.jpg')
|
7 |
|
|
|
|
|
|
|
8 |
def getAnswer(query, image):
|
9 |
encoding = processor(image, text, return_tensors="pt")
|
10 |
|
|
|
5 |
torch.hub.download_url_to_file('http://images.cocodataset.org/val2017/000000039769.jpg', 'cats.jpg')
|
6 |
torch.hub.download_url_to_file('https://cdn.openai.com/dall-e-2/demos/text2im/astronaut/horse/photo/0.jpg', 'astronaut.jpg')
|
7 |
|
8 |
+
processor = ViltProcessor.from_pretrained("dandelin/vilt-b32-finetuned-vqa")
|
9 |
+
model = ViltForQuestionAnswering.from_pretrained("dandelin/vilt-b32-finetuned-vqa")
|
10 |
+
|
11 |
def getAnswer(query, image):
|
12 |
encoding = processor(image, text, return_tensors="pt")
|
13 |
|