Creating a Permanent Data Object in Django

I have a Python-based maximum entropy classifier. It is large, stored as a pickel, and takes about a minute to unstable. It is also not thread safe. However, it is fast and can classify a sample (a simple Python dictionary) in a few milliseconds.

I would like to create a basic Django web application so that users can submit samples for classification in real time. How can I once load the classifier into read-only memory and then adjust it so that each request can access the object without contradicting other requests?

+4
source share
2 answers

you can use djangos cache-framework and set the timeout to extreme value

+4
source

Try to start it in another process. You can send the Django application using a socket that listens for the classifier process, or you can start the queue and send Django requests to the queue.

+2
source

Source: https://habr.com/ru/post/1302539/


All Articles