6

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

I'd like to create a basic Django web app, so users can submit samples to classify in realtime. How would I load the classifier into persistent memory once, and then regulate it so that each request can access the object without conflicting with other requests?

2 Answers 2

4

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

Sign up to request clarification or add additional context in comments.

2 Comments

Clever and dead-simple to implement. Great suggestion.
@Cerin could you elaborate a bit more on the solution
2

Consider running it in another process. You could have your Django application submit samples via a socket that the classifier process listens on, or you could run a queue and have Django submit requests to the queue.

1 Comment

Yes, running the classifier in it's own server would work, but that seems overkill. I was looking for something that utilizes Django's framework.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.