Python Forum

Full Version: Am I going about this wrong?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.