File size: 472 Bytes
831e4f7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import requests
import io
from PIL import Image
img = Image.new('RGB', (100, 100), color = 'red')
img_byte_arr = io.BytesIO()
img.save(img_byte_arr, format='JPEG')
img_byte_arr.seek(0)
try:
response = requests.post(
"https://flash69-ocr.hf.space/extract_ledger",
files={'file': ('test.jpg', img_byte_arr, 'image/jpeg')}
)
print("Status:", response.status_code)
print("Body:", response.text)
except Exception as e:
print("Error:", e)
|