Rashad
Rashad

Reputation: 245

How to connect a Machine Learning classifier to a Web App?

I'm trying to build a sentiment classifier web app, but I don't understand who to connect the machine learning component with the web app. I've built the client-side web app that's running on a NodeJS server, and I've trained a sentiment classifier that saved as a Python script.

My goal is to have users submit text on the web app, send it to the Python script, classify, and send the result back via JSON.

How should I setup the Machine Learning-Web App pipeline?

One suggestion was to load the Python script in Flask, and use Flask as a REST API. It seems as though using Flask would be overkill since I only need to do one task.

Upvotes: 2

Views: 1392

Answers (2)

JaNe
JaNe

Reputation: 9

Your two main options are through a web framework, like Flask, or with a CGI bridge, simply speaking it's like writing/reading directly to the terminal.

I wrote a tutorial, where I call the combine work of FullStack and Machine Learning : Smart Stack using Meteor - Angular2 and Scikit-learn.

The part which will interest you is the second: 2- Server Side and possibly the third: 3- Model Optimisation

I have some concern about the scalability of this process over REST style (I have to dig deeper into that point), but for a prototype and/or a small app it should be fine.

Upvotes: -1

Freek Wiekmeijer
Freek Wiekmeijer

Reputation: 4940

Flask is a relatively simple web framework. It will suit your need to get the user-submitted text into a python function, without too much boilerplate code or complexity. There are alternatives, most notably Tornado.

I do wonder why you would stack two REST interfaces on top of eachother. Do you need the node.js application for specific reasons? If not, you can simplify your architecture.

Upvotes: 2

Related Questions