Irpan commited on
Commit
97db7c3
1 Parent(s): 64f507f
Files changed (2) hide show
  1. app.py +3 -1
  2. requirements.txt +2 -1
app.py CHANGED
@@ -1,6 +1,8 @@
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
 
@@ -23,7 +25,7 @@ def answer_question(image, text):
23
  image = gr.inputs.Image(type="pil")
24
  question = gr.inputs.Textbox(label="Question")
25
  answer = gr.outputs.Textbox(label="Predicted answer")
26
- examples = [["cats.jpg", "How many cats are there?"]]
27
 
28
  title = "Cross-lingual VQA"
29
  description = "ViLT (Vision and Language Transformer), fine-tuned on VQAv2 "
 
1
  import gradio as gr
2
  from transformers import ViltProcessor, ViltForQuestionAnswering
3
  import torch
4
+ from googletrans import Translator
5
+ from googletrans import LANGCODES
6
 
7
  torch.hub.download_url_to_file('http://images.cocodataset.org/val2017/000000039769.jpg', 'cats.jpg')
8
 
 
25
  image = gr.inputs.Image(type="pil")
26
  question = gr.inputs.Textbox(label="Question")
27
  answer = gr.outputs.Textbox(label="Predicted answer")
28
+ examples = [["cats.jpg", "How many cats are there, in French?"]]
29
 
30
  title = "Cross-lingual VQA"
31
  description = "ViLT (Vision and Language Transformer), fine-tuned on VQAv2 "
requirements.txt CHANGED
@@ -1,3 +1,4 @@
1
- gradio
2
  torch
3
  git+https://github.com/huggingface/transformers.git
 
 
1
+ gradio==2.9.1
2
  torch
3
  git+https://github.com/huggingface/transformers.git
4
+ googletrans==4.0.0-rc1