5

I've deployed a ML Model on AWS. It's an image classifier. When I provide the following images to the ML Model via a form in Flask, it works in certain cases but doesn't work in other cases.

The link of the image which work is listed below: https://drive.google.com/file/d/1hbrEa2gNLdqGPJxp5jVxWcXl1wunp5Mc/view?usp=sharing

The link of the image which gives an error is listed below: https://drive.google.com/file/d/1znWTRnTMPft_r_jwpJ0JQuMnnazsUXs-/view?usp=sharing

Both of the above images look alike. The first image which is around 150kb of size works when I select the file and upload it for analysis. The image which is around 10kb however doesn't when I select and upload it for analysis from a PC. When I try to do the same with my mobile phone browser, both show an error.

The error shown in the logs is - [warn]: a client request body is buffered to a temporary file.

Resham Sundar
  • 131
  • 1
  • 1
  • 6

1 Answers1

8

I figured out the answer by following this link: Increasing client_max_body_size in Nginx conf on AWS Elastic Beanstalk The nginx configuration settings should be performed in a folder named .platform.

The folder structure is (.platform/nginx/conf.d/proxy.conf)

Inside the proxy.conf mention:

client_body_buffer_size 50M;(the size according to your requirement).

Inside the .platform folder make another file named 00_myconf.config with the following contents:

container_commands:
 01_reload_nginx:
   command: "service nginx reload"

AWS documentation regarding configuring nginx: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html (Read the reverse proxy configuration)

Resham Sundar
  • 131
  • 1
  • 1
  • 6