r/pythonhelp • • Nov 23 '20

[help] Using a model in a web page

I've a Python program that menipulates an image, I've tryed to convert the program to be compitible with flask, but it dosen't seems to work. I've desided to do the processing on the webserver and not the client. But how do I all people upload to the webserver, menipulate the image, and send it back?

2 Upvotes

3 comments sorted by

1

u/ace6807 Nov 23 '20

How long does the process take at it's longest? If it's super short and you can get away with doing it in the request response cycle, then one way to get away with it is to get the incoming request, do the image processing, store the result, redirect the user to another page which can serve the result. If it's a longer process, you could offload the task to a task queue and then allow the user to pick the result up when it's finished at another endpoint. This obviously adds a bit of complexity as you need some way for the user to know the task is done processing such as a notification or another place to the check the progress/status of the task

1

u/yaliharel10 Nov 23 '20

Thank you, I really appritiate it :-)

1

u/ace6807 Nov 23 '20

Glad to help. If you go the task queue rout I suggest RQ https://python-rq.org/ for simple stuff. Celery is great but a little complex