Anniek commited on
Commit
440d6b3
·
1 Parent(s): 1c218d3

Update app.py

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