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 requestsimport gradio as grfrom IPython.display import Imagefrom IPython.core.display import HTMLimage_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(’_')))}:")
2022-11-27T18:16:14Z
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.Fromthis postit seems that others have problems uploading similarly ‘small’ files.
2022-11-29T10:22:48Z
Hey@plexus3d.The usage of this URI is deprecated in favor ofhttps://tmabraham-fastai-pet-classifier.hf.space/api/predict/which allows bigger payloads.You can find this URL clicking theEmbed this Spaceoption: