Spaces:
Sleeping
Sleeping
Update inference.py
Browse files- inference.py +1 -1
inference.py
CHANGED
@@ -15,7 +15,7 @@ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
|
15 |
model.to(device)
|
16 |
|
17 |
|
18 |
-
def prediction(image):
|
19 |
boxes, words = OCR(image)
|
20 |
encoding = processor(image, words, boxes=boxes, return_offsets_mapping=True, return_tensors="pt", truncation=True)
|
21 |
offset_mapping = encoding.pop('offset_mapping')
|
|
|
15 |
model.to(device)
|
16 |
|
17 |
|
18 |
+
def prediction(Image.open(image)):
|
19 |
boxes, words = OCR(image)
|
20 |
encoding = processor(image, words, boxes=boxes, return_offsets_mapping=True, return_tensors="pt", truncation=True)
|
21 |
offset_mapping = encoding.pop('offset_mapping')
|