MindsDBMERNVideo.mp4
This is a simple web application that allows you to analyze a comment by classifing it in three columns: positive, negative and neutral. It uses huggingface model to classify the comment.
The main aim of making this project was to learn how to use MindsDB with web in the MERN Stack.
There was no blog, video, documentation or anything that could help me to learn how to use MindsDB with web in the MERN Stack. It was solely on me to do this with no help.
I figured out how to connect MindsDB with the web and made this project. You can look at this project to understand how to achieve the same. Also, I soon will be writing documentation for doing this in MindsDB official Docs, so keep an eye on that.
-
Install and Run MindsDB locally. You can follow the steps through official documentations.
-
Start MongoSH or Mongo Compass and use the
mindsdb
database.In mongosh:
use mindsdb
-
Creat a Huggingface model in the
models
collection of themindsdb
database we earlier switched to.db.models.insertOne({ name: 'sentiment_classifier', predict: 'sentiment', training_options: { engine: 'huggingface', task: 'text-classification', model_name: 'cardiffnlp/twitter-roberta-base-sentiment', input_column: 'comment', labels: ['negative','neutral','positive'] } })
On execution, we get something like this:
{ acknowledged: true, insertedId: ObjectId("63c00c704d444a0b83808420") }
Check the status of the generation using this command:
db.getCollection('models').find({'name': 'sentiment_classifier'})
On execution we get something like this:
{ NAME: 'sentiment_classifier_hf', PROJECT: 'mindsdb', VERSION: 1, STATUS: 'complete', ACCURACY: null, PREDICT: 'sentiment', UPDATE_STATUS: 'up_to_date', MINDSDB_VERSION: '22.11.4.3', ERROR: null, SELECT_DATA_QUERY: null, TRAINING_OPTIONS: '{\'target\': \'sentiment\', \'using\': {\'task\': \'text-classification\', \'model_name\': \'cardiffnlp/ twitter-roberta-base-sentiment\', \'input_column\': \'comment\', \'labels\': [\'negative\', \'neutral\', \'positive\']}} ', TAG: null }
When the
STATUS
iscomplete
, we can move to the next step. -
Fork and clone this repository.
-
Install the dependencies.
-
Install Client dependencies.
cd client npm install
-
Install Server dependencies.
cd server npm install
-
-
Start the project:
-
Start the server:
cd server npm start
-
Start the client:
cd client npm run dev
While starting the server, make sure your mindsdb is running with the
mongodb
api. -
-
Open the browser and go to
localhost:5173
to see the project.
If you face any issue with this project, do let me know. You can contact me through Twitter or find me on other social media platforms here