thoth_app / test_ocr.py
GitHub Actions
Sync from GitHub
4f54856
raw
history blame contribute delete
664 Bytes
import requests
import sys
try:
with open('c:/Users/HP DRAGONFLY/Downloads/projects/thoth_app/thoth_app/rag/chain.py', 'rb') as f:
pass
except Exception as e:
pass
url = "https://ocr-service-410603182993.australia-southeast2.run.app/upload"
# Create a dummy image
from PIL import Image
import io
img = Image.new('RGB', (100, 30), color = (73, 109, 137))
img_byte_arr = io.BytesIO()
img.save(img_byte_arr, format='PNG')
img_byte_arr = img_byte_arr.getvalue()
files = {'file': ('test.png', img_byte_arr, 'image/png')}
response = requests.post(f"{url}?lang=cop", files=files)
print("Status:", response.status_code)
print("Text:", response.text)