简体   繁体   English

如何通过在同一EC2中运行的python-flask网络应用将图像上传到EC2?

[英]How to upload image to EC2 through a python-flask web app running in the same EC2?

I have Python-Flask web-app running inside EC2 which performs a binary image classification. 我在EC2内部运行了Python-Flask Web应用程序,该应用程序执行了二进制图像分类。 The web-app has a UI which allows the user to select the image. 该Web应用程序具有一个UI,允许用户选择图像。

High Level Architecture: 高层架构:

 1. Select the file to 
    be uploaded using the
    web-app UI

 2. Press the "Classify" button.

 3. Image gets uploaded to EC2.

 4. Perform image classification
    and return the results.

 5. Delete the image.

Could you please guide me on how to upload the image located on my machine to EC2 (Step 3) ? 您能否指导我如何将机器上的图像上传到EC2(第3步)?

When you press the "Classify" button, your form on your web-app will pass a multipart form data to the flask application. 当您按下“分类”按钮时,Web应用程序上的表单会将多部分表单数据传递给flask应用程序。 Then within Python, you'll intercept that and save the file. 然后在Python中,您将对其进行拦截并保存文件。

Python has a great intro on this here: http://flask.pocoo.org/docs/1.0/patterns/fileuploads/ Python在这里对此进行了很好的介绍: http : //flask.pocoo.org/docs/1.0/patterns/fileuploads/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM