Spaces:
Runtime error
Runtime error
File size: 619 Bytes
3d2a3a3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import requests
def ocr_call(api_url, file_path, post_processing, sparrow_key):
with open(file_path, "rb") as file:
# Prepare the payload
files = {
'file': (file.name, file, 'image/jpeg')
}
data = {
'image_url': '',
'post_processing': post_processing,
'sparrow_key': sparrow_key
}
response = requests.post(api_url, data=data, files=files)
if response.status_code != 200:
print('Request failed with status code:', response.status_code)
print('Response:', response.text)
return response.text
|