File size: 358 Bytes
795183d
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
print("Testing TrOCR model...")
from transformers import pipeline
pipe = pipeline("image-to-text", model="microsoft/trocr-base-handwritten")
print("SUCCESS! Model loaded!")

from PIL import Image
img = Image.open("test_singtel_bill.png")
result = pipe(img)
print(f"Extracted: {result[0]['generated_text']}")
print("COMPLETE! Ready to scan bills!")