Add gitignore
Browse files- .gitignore +3 -0
- app.py +4 -4
.gitignore
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
checkpoints/
|
| 2 |
+
env_vqa/
|
| 3 |
+
|
app.py
CHANGED
|
@@ -27,8 +27,8 @@ use_cuda = torch.cuda.is_available()
|
|
| 27 |
# use fp16 only when GPU is available
|
| 28 |
use_fp16 = False
|
| 29 |
|
| 30 |
-
os.system('wget https://huggingface.co/komleva/VQAmodel/resolve/main/checkpoint.best_score_0.9840.pt; '
|
| 31 |
-
'mkdir -p checkpoints; mv checkpoint.best_score_0.9840.pt checkpoints/checkpoint.best_score_0.9840.pt')
|
| 32 |
|
| 33 |
# specify some options for evaluation
|
| 34 |
parser = options.get_generation_parser()
|
|
@@ -169,7 +169,7 @@ def open_domain_vqa(Image, Question):
|
|
| 169 |
left = left -10
|
| 170 |
|
| 171 |
|
| 172 |
-
return Image.crop((left, top, right, bottom))
|
| 173 |
|
| 174 |
|
| 175 |
title = "Visual Question Answering"
|
|
@@ -177,7 +177,7 @@ description = " Demo for Visual Question Answering. That model achieved 3rd plac
|
|
| 177 |
#article = "<p style='text-align: center'><a href='https://github.com/OFA-Sys/OFA' target='_blank'>OFA Github " \
|
| 178 |
# "Repo</a></p> "
|
| 179 |
examples = [['demo_imgs/000000001093.jpg', 'Which is different from the group?'], ['demo_imgs/000000001964.jpg','What do we drive for personal use?'], ['demo_imgs/000000002473.jpg','What do we use to slide on snow?']]
|
| 180 |
-
io = gr.Interface(fn=open_domain_vqa, inputs=[gr.inputs.Image(type='pil'), "textbox"], outputs=gr.outputs.Image(type='pil')
|
| 181 |
title=title, description=description, examples=examples,
|
| 182 |
allow_flagging=False, allow_screenshot=False)
|
| 183 |
io.launch()
|
|
|
|
| 27 |
# use fp16 only when GPU is available
|
| 28 |
use_fp16 = False
|
| 29 |
|
| 30 |
+
#os.system('wget https://huggingface.co/komleva/VQAmodel/resolve/main/checkpoint.best_score_0.9840.pt; '
|
| 31 |
+
# 'mkdir -p checkpoints; mv checkpoint.best_score_0.9840.pt checkpoints/checkpoint.best_score_0.9840.pt')
|
| 32 |
|
| 33 |
# specify some options for evaluation
|
| 34 |
parser = options.get_generation_parser()
|
|
|
|
| 169 |
left = left -10
|
| 170 |
|
| 171 |
|
| 172 |
+
return Image.crop((left, top, right, bottom)), result[0]['answer']
|
| 173 |
|
| 174 |
|
| 175 |
title = "Visual Question Answering"
|
|
|
|
| 177 |
#article = "<p style='text-align: center'><a href='https://github.com/OFA-Sys/OFA' target='_blank'>OFA Github " \
|
| 178 |
# "Repo</a></p> "
|
| 179 |
examples = [['demo_imgs/000000001093.jpg', 'Which is different from the group?'], ['demo_imgs/000000001964.jpg','What do we drive for personal use?'], ['demo_imgs/000000002473.jpg','What do we use to slide on snow?']]
|
| 180 |
+
io = gr.Interface(fn=open_domain_vqa, inputs=[gr.inputs.Image(type='pil'), "textbox"], outputs=[gr.outputs.Image(type='pil'),gr.outputs.Textbox(label="Answer")],
|
| 181 |
title=title, description=description, examples=examples,
|
| 182 |
allow_flagging=False, allow_screenshot=False)
|
| 183 |
io.launch()
|