-show link image
Browse files
image.py
CHANGED
@@ -6,7 +6,7 @@ from PIL import Image
|
|
6 |
# prepare image + question
|
7 |
url = "https://i.imgur.com/qs0CxjE_d.webp?maxwidth=760&fidelity=grand"
|
8 |
image = Image.open(requests.get(url, stream=True).raw)
|
9 |
-
text = "
|
10 |
|
11 |
processor = ViltProcessor.from_pretrained("dandelin/vilt-b32-finetuned-vqa")
|
12 |
model = ViltForQuestionAnswering.from_pretrained("dandelin/vilt-b32-finetuned-vqa")
|
@@ -20,4 +20,5 @@ logits = outputs.logits
|
|
20 |
idx = logits.argmax(-1).item()
|
21 |
st.write("Predicted answer:", model.config.id2label[idx])
|
22 |
print("question asked:", text)
|
|
|
23 |
print("Predicted answer:", model.config.id2label[idx])
|
|
|
6 |
# prepare image + question
|
7 |
url = "https://i.imgur.com/qs0CxjE_d.webp?maxwidth=760&fidelity=grand"
|
8 |
image = Image.open(requests.get(url, stream=True).raw)
|
9 |
+
text = "What is the two color's car ?"
|
10 |
|
11 |
processor = ViltProcessor.from_pretrained("dandelin/vilt-b32-finetuned-vqa")
|
12 |
model = ViltForQuestionAnswering.from_pretrained("dandelin/vilt-b32-finetuned-vqa")
|
|
|
20 |
idx = logits.argmax(-1).item()
|
21 |
st.write("Predicted answer:", model.config.id2label[idx])
|
22 |
print("question asked:", text)
|
23 |
+
print("image link:", url)
|
24 |
print("Predicted answer:", model.config.id2label[idx])
|