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 = ‘

data = gr.processing_utils.encode_url_or_file_to_base64(image_url)
r =‘’, json={“data”:[data]})


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 which allows bigger payloads.

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