Spaces:
Runtime error
Runtime error
Update name of model
Browse files
app.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from transformers import ViltProcessor,
|
| 3 |
import torch
|
| 4 |
|
| 5 |
torch.hub.download_url_to_file('http://images.cocodataset.org/val2017/000000039769.jpg', 'cats.jpg')
|
| 6 |
torch.hub.download_url_to_file('https://computing.ece.vt.edu/~harsh/visualAttention/ProjectWebpage/Figures/vqa_1.png', 'banana.png')
|
| 7 |
|
| 8 |
processor = ViltProcessor.from_pretrained("dandelin/vilt-b32-finetuned-vqa")
|
| 9 |
-
model =
|
| 10 |
|
| 11 |
def answer_question(image, text):
|
| 12 |
encoding = processor(image, text, return_tensors="pt")
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import ViltProcessor, ViltForQuestionAnswering
|
| 3 |
import torch
|
| 4 |
|
| 5 |
torch.hub.download_url_to_file('http://images.cocodataset.org/val2017/000000039769.jpg', 'cats.jpg')
|
| 6 |
torch.hub.download_url_to_file('https://computing.ece.vt.edu/~harsh/visualAttention/ProjectWebpage/Figures/vqa_1.png', 'banana.png')
|
| 7 |
|
| 8 |
processor = ViltProcessor.from_pretrained("dandelin/vilt-b32-finetuned-vqa")
|
| 9 |
+
model = ViltForQuestionAnswering.from_pretrained("dandelin/vilt-b32-finetuned-vqa")
|
| 10 |
|
| 11 |
def answer_question(image, text):
|
| 12 |
encoding = processor(image, text, return_tensors="pt")
|