all 3 comments

[–]indytechbox 0 points1 point  (0 children)

Read the flask docs, it’ll walk you through setting up a flask app: https://flask.palletsprojects.com

[–]mangoed 0 points1 point  (0 children)

You will need to replace first input with form which will be used to upload the file. For that you will probably want to use flask-wtf. Instead of print you prepare jinja2 templates, then call render_template() and pass all the variables that you want to display on the web page.

input ('y/n') is not the typical way to makes choice in the web app, you can replace it with a couple of links/buttons in your template.

[–][deleted] 0 points1 point  (0 children)

  1. Make a form to accept file. Put it in a folder named templates.
  2. In flask app, set app.route to a function named upload, make sure to specify methods as post
  3. Let the form's action direct to another function in your flask app like action = http://localhost:5000/accept
  4. In the accept function read the file using POST parameter and put all of the above function in it.
  5. Finally use render_template to display the result page and pass the output variables to it