| 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) | |