2. Analyzing sentiment
In Part 1 you deployed the Sentiment Demo UI, interacted with the UI to send messages and view messages of other users, and saw those messages displayed in the UI in real time.
In this part of the tutorial you analyze the sentiment of the conversation by adding a new node to the processing pipeline.
This sentiment analysis microservice utilizes a prebuilt model from huggingface.co to analyze the sentiment of each message flowing through the microservice.
The microservice subscribes to data from the
messages topic and publishes sentiment results to the
While this tutorial uses a prebuilt sentiment analysis library item, it is also possible to build one from a basic template available in the Quix library. If you are interested in building your own service, you can refer to an optional part of this tutorial, where you learn how to code a sentiment analysis service from the basic template.
Deploying the sentiment analysis service
The sentiment of each message will be evaluated by this new microservice in your message processing pipeline.
Follow these steps to deploy the prebuilt sentiment analysis microservice:
Navigate to the Library and search for
Setup & deploybutton.
Ensure the "input" is set to
This is the topic that is subscribed to for messages to analyze.
Ensure the "output" is set to
This is the topic that sentiment results are published to.
This deploys the service using the default settings. If you later find that this microservice is not performing as expected, then you can subsequently edit the deployment, and increase the resources allocated.
Navigate to the web page for the UI project you deployed in Part 1.
Enter values for
CONNECT, or re-enter the room.
Now enter chat messages and see the sentiment being updated in real time each time a message is posted. An example of this is shown in the following screenshot:
The sentiment analysis service you just deployed subscribes to the
messages topic. The sentiment is returned to the UI through the
sentiment topic, and displayed both in the chart and next to the comment in the chat window by colorizing the chat user's name.
You have added to the pipeline by building and deploying a microservice to analyze the chat messages in real time.