Spaces POST: response [413] 'request entity too large'

I’ve successfully used the following snippet to call the classifier specified below, with small images. When using the image such as the below (< 1MB), I see 413 errors. From other forum posts I believe the file size is not the real problem here; what might I be missing?

import requests
import gradio as gr
from IPython.display import Image
from IPython.core.display import HTML

image_url = ‘https://i.natgeofe.com/n/548467d8-c5f1-4551-9f58-6817a8d2c45e/NationalGeographic_2572187_square.jpg

data = gr.processing_utils.encode_url_or_file_to_base64(image_url)
r = requests.post(url=‘https://hf.space/embed/tmabraham/fastai_pet_classifier/+/api/predict/’, json={“data”:[data]})

print(r)
print(r.json())
print(“-----”)

print(f"The breed of this pet is a {(’ ‘.join(r.json()[‘data’][0][‘label’].split(’_')))}:")

It looks like file size is the issue here when getting these [413] errors from the server: I’ve lowered the payload size progressively to the point where a ~200Kb base64 payload succeeds.

It would be helpful for HF to state an explicit limit, and whether the upload limit changes with a Pro account or when hosting the input URLs in Spaces/Hub v. external domains.

From this post it seems that others have problems uploading similarly ‘small’ files.

Hey @plexus3d.
The usage of this URI is deprecated in favor of https://tmabraham-fastai-pet-classifier.hf.space/api/predict/ which allows bigger payloads.

You can find this URL clicking the Embed this Space option:
image