Python Forum
Am I going about this wrong? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: Am I going about this wrong? (/thread-8594.html)



Am I going about this wrong? - Oliver - Feb-27-2018

I have a Flask Web Service.

In one of the POST methods, I read and build a SVC classifier. It works! Hurray.

----

What I was thinking was that in another POST method (TBD) I would just do predictions on the already-built classifier from the first method -- so I wouldn't need to build the model every time.

However, I'm not sure the method where I build the model is still there after the return. I'm thinking it may be since this is a web service, not a regular method, but I'm not sure.

Assuming the model is still around in the original method after it returns a 'model built' message to the user, how would I access the model variables from another POST method? Would I need to declare them "global" in the first method?

Would appreciate suggestions on how to best set this up.

Thanks!