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

**URL:** <https://discuss.huggingface.co/t/spaces-post-response-413-request-entity-too-large/26723>\
**Category:** Spaces\
**Created:** [November 26, 2022, 12:02am UTC](https://discuss.huggingface.co/t/spaces-post-response-413-request-entity-too-large/26723 "2022-11-26T00:02:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![plexus3d](https://avatars.discourse-cdn.com/v4/letter/p/f08c70/32.png) [@plexus3d](https://discuss.huggingface.co/u/plexus3d)\
**Post date:** [November 26, 2022, 12:02am UTC](https://discuss.huggingface.co/t/spaces-post-response-413-request-entity-too-large/26723/1 "2022-11-26T00:02:03Z")

</div>

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](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/](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(’\_')))}:")

---

<div class="post-metadata">

**Author:** ![plexus3d](https://avatars.discourse-cdn.com/v4/letter/p/f08c70/32.png) [@plexus3d](https://discuss.huggingface.co/u/plexus3d)\
**Post date:** [November 27, 2022, 6:16pm UTC](https://discuss.huggingface.co/t/spaces-post-response-413-request-entity-too-large/26723/2 "2022-11-27T18:16:14Z")

</div>

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](https://discuss.huggingface.co/t/using-inference-api-with-large-audio-files/17847/4) it seems that others have problems uploading similarly ‘small’ files.

---

<div class="post-metadata">

**Author:** ![chris-rannou](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@chris-rannou](https://discuss.huggingface.co/u/chris-rannou)\
**Post date:** [November 29, 2022, 10:22am UTC](https://discuss.huggingface.co/t/spaces-post-response-413-request-entity-too-large/26723/3 "2022-11-29T10:22:48Z")

</div>

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](https://us1.discourse-cdn.com/hellohellohello/original/2X/0/041993c19adb5da70003947bf5768a89f3397084.png)
