I wrote a Python Flask App for different image processing tasks. It seems redundant to post the same image over and over again, if I want to perform multiple image processing tasks on the same image. So I was wondering if I can include some kind of cache in my app that stores the last 10 images that have been posted.
import .....
app = Flask(__name__)
@app.route('/processing/task1', methods=["POST"])
def task1():
...
return
@app.route('/processing/task2', methods=["POST"])
def task2():
...
return
@app.route('somethingcompletelydifferent', methods=["POST"])
def different():
...
return
if __name__ == '__main__':
app.run(debug=config.app['debug'], port=config.app['port'], host=config.app['host'])
My aim would be that when I am running
answer = requests.post("http://localhost:5000/processing/task1", files=arg).content
the image contained in arg is only being transmitted, if it hasn't (yet/for a while) been transmitted. Is there a way to do that in the app? I am really confused right now and can't figure out how to do it - probably because I am missing some terms and basic knowledge in that field and fail to google it effectively ... Thanks!
(I am using python 3.7)