Spaces:
Runtime error
Runtime error
Add truncation for inputs that are too long
Browse files
app.py
CHANGED
@@ -52,7 +52,7 @@ def process_image(image):
|
|
52 |
words, boxes = encoding_feature_extractor.words, encoding_feature_extractor.boxes
|
53 |
|
54 |
# encode
|
55 |
-
encoding = tokenizer(words, boxes=boxes, return_offsets_mapping=True, return_tensors="pt")
|
56 |
offset_mapping = encoding.pop('offset_mapping')
|
57 |
encoding["image"] = encoding_feature_extractor.pixel_values
|
58 |
|
|
|
52 |
words, boxes = encoding_feature_extractor.words, encoding_feature_extractor.boxes
|
53 |
|
54 |
# encode
|
55 |
+
encoding = tokenizer(words, boxes=boxes, truncation=True, return_offsets_mapping=True, return_tensors="pt")
|
56 |
offset_mapping = encoding.pop('offset_mapping')
|
57 |
encoding["image"] = encoding_feature_extractor.pixel_values
|
58 |
|