Spaces:
Running
Running
pix2struct
Browse files
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-
|
| 149 |
-
model3 = Pix2StructForConditionalGeneration.from_pretrained('google/matcha-plotqa-
|
| 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 =
|
| 158 |
-
model3 =
|
| 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-
|
| 174 |
-
model3 = Pix2StructForConditionalGeneration.from_pretrained('google/matcha-plotqa-
|
| 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)
|