dakkoong commited on
Commit
9b582e7
1 Parent(s): 2054da9

initial commit

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -1,10 +1,12 @@
1
  import gradio as gr
2
- from transformers import Blip2ForVisualQuestionAnswering, Blip2Config, AutoTokenizer
3
  from PIL import Image
4
  import torch
5
 
 
6
  model_path = "microsoft/git-base-vqav2"
7
  dataset_name = "Multimodal-Fatima/OK-VQA_train"
 
8
 
9
  questions = ["What can happen the objects shown are thrown on the ground?",
10
  "What was the machine beside the bowl used for?",
@@ -17,7 +19,8 @@ questions = ["What can happen the objects shown are thrown on the ground?",
17
  "Where can that toilet seat be bought?",
18
  "What do you call the kind of pants that the man on the right is wearing?"]
19
 
20
- model = Blip2ForVisualQuestionAnswering.from_pretrained(model_path)
 
21
 
22
 
23
  def main(select_exemple_num):
 
1
  import gradio as gr
2
+ from transformers import AutoProcessor, AutoModelForVisualQuestionAnswering, AutoModelForCausalLM, AutoTokenizer
3
  from PIL import Image
4
  import torch
5
 
6
+ model = AutoModelForCausalLM.from_pretrained("microsoft/git-base-vqav2")
7
  model_path = "microsoft/git-base-vqav2"
8
  dataset_name = "Multimodal-Fatima/OK-VQA_train"
9
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
10
 
11
  questions = ["What can happen the objects shown are thrown on the ground?",
12
  "What was the machine beside the bowl used for?",
 
19
  "Where can that toilet seat be bought?",
20
  "What do you call the kind of pants that the man on the right is wearing?"]
21
 
22
+ processor = AutoProcessor.from_pretrained(model_path)
23
+ model = AutoModelForVisualQuestionAnswering.from_pretrained(model_path)
24
 
25
 
26
  def main(select_exemple_num):