Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Machine Learning by (19k points)

I have a django form, which is collecting user response. I also have a tensorflow sentences classification model. What is the best/standard way to put these two together. Details:

  1. Tensorflow model was trained on the Movie Review data from Rotten Tomatoes.
  2. Everytime a new row is made in my response model , i want the tensorflow code to classify it( + or - ).
  3. Basically I have a django project directory and two .py files for classification. Before going ahead myself , i wanted to know what is the standard way to implement machine learning algorithms to a web app.

It'd be awesome if you could suggest a tutorial or a repo. Thank you !

1 Answer

0 votes
by (33.1k points)

There are three methods to use scikit learn in Django

Asynchronous processing:

If you don't need the classification result from the ML code to pass immediately to the user, then you can always queue the classification job to run in the background or even a different server with more CPU/memory resources.

A queued task used to populate the field UserResponse.class_name (positive, negative) on the database rows that have that field blank.

Real-time notification

If the ML code runs slow and wants to return that result to the user as soon as it is available, you can use the asynchronous approach, and pair with the real-time notification.

It's important if ML execution time is so long that it might time-out the HTTP request in the synchronous approach.

Synchronous processing, if the ML code is not CPU intensive.

If you need classification results instantly, then the ML classification should be fast enough, you can do so within the HTTP request-response cycle.

Hope this answer helps you! 

Study Tensorflow Tutorial for more details. Since Tensorflow is a part of Machine Learning, it will quite evident for a student to learn Machine Learning Course as well.

Browse Categories

...