MediPlusPlus commited on
Commit
707861f
·
verified ·
1 Parent(s): 02c2ac7

pix2struct

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -145,8 +145,8 @@ def m3(que, image):
145
 
146
 
147
  def m4(que, image):
148
- processor3 = Pix2StructProcessor.from_pretrained('google/matcha-plotqa-v2')
149
- model3 = Pix2StructForConditionalGeneration.from_pretrained('google/matcha-plotqa-v2')
150
 
151
  inputs = processor3(images=image, text=que, return_tensors="pt")
152
  predictions = model3.generate(**inputs, max_new_tokens=512)
@@ -154,8 +154,8 @@ def m4(que, image):
154
 
155
  def m5(que, image):
156
 
157
- processor3 = AutoProcessor.from_pretrained("google/pix2struct-ocrvqa-large")
158
- model3 = AutoModelForSeq2SeqLM.from_pretrained("google/pix2struct-ocrvqa-large")
159
 
160
  inputs = processor3(images=image, text=que, return_tensors="pt")
161
 
@@ -170,8 +170,8 @@ def m6(que, image):
170
 
171
  # predictions = model3.generate(**inputs)
172
  # return processor3.decode(predictions[0], skip_special_tokens=True)
173
- processor3 = Pix2StructProcessor.from_pretrained('google/matcha-plotqa-v2')
174
- model3 = Pix2StructForConditionalGeneration.from_pretrained('google/matcha-plotqa-v2')
175
 
176
  inputs = processor3(images=image, text=que, return_tensors="pt")
177
  predictions = model3.generate(**inputs, max_new_tokens=512)
 
145
 
146
 
147
  def m4(que, image):
148
+ processor3 = Pix2StructProcessor.from_pretrained('google/matcha-plotqa-v1')
149
+ model3 = Pix2StructForConditionalGeneration.from_pretrained('google/matcha-plotqa-v1')
150
 
151
  inputs = processor3(images=image, text=que, return_tensors="pt")
152
  predictions = model3.generate(**inputs, max_new_tokens=512)
 
154
 
155
  def m5(que, image):
156
 
157
+ processor3 = Pix2StructProcessor.from_pretrained("google/pix2struct-ocrvqa-large")
158
+ model3 = Pix2StructForConditionalGeneration.from_pretrained("google/pix2struct-ocrvqa-large")
159
 
160
  inputs = processor3(images=image, text=que, return_tensors="pt")
161
 
 
170
 
171
  # predictions = model3.generate(**inputs)
172
  # return processor3.decode(predictions[0], skip_special_tokens=True)
173
+ processor3 = Pix2StructProcessor.from_pretrained('google/matcha-plotqa-v1')
174
+ model3 = Pix2StructForConditionalGeneration.from_pretrained('google/matcha-plotqa-v1')
175
 
176
  inputs = processor3(images=image, text=que, return_tensors="pt")
177
  predictions = model3.generate(**inputs, max_new_tokens=512)