Sentiment analysis UI to check whether tweets are ok or not.
The UI will query the backend API using a POST to $BASE_URL/api/analysis
containing the following json body:
{
"content": "This is a bad sentence"
}
It expects a response in the format:
{
"toxicity":false,
"threat":false,
"sexualExplicit":false,
"severeToxicity":false,
"obscene":false,
"insult":false,
"identityAttack":false
}
The $BASE_URL
environment variable needs to be set at build time and must start with http:// or https://
You can run the service locally by running:
npm install
BASE_URL=http://localhost:8080 npm run webpack:server
You can deploy the UI as a static website or as a service, it's up to you.
To bundle the UI for static website deployment, run
npm install
BASE_URL=http://localhost:8080 npm run webpack:bundle
This will bundle the HTML and js files into the dist/
folder which you can then deploy.
To test that the site works, run
npm run serve
and open http://localhost:9000
To deploy the UI as a service, you can use the provided Dockerfile which runs the UI in an integrated HTTP server, e.g. by running:
docker build --no-cache --build-arg base_url=http://localhost:8080 -t="hivemind/tweet-ui" -f docker/Dockerfile .
docker run -ti -p 9000:9000 hivemind/tweet-ui:latest
and open http://localhost:9000