{"id":15990813,"url":"https://github.com/prrao87/fine-grained-sentiment-app-streamlit","last_synced_at":"2025-03-27T07:31:31.679Z","repository":{"id":131348754,"uuid":"298892686","full_name":"prrao87/fine-grained-sentiment-app-streamlit","owner":"prrao87","description":"A LIME explainer app for fine-grained sentiment classification, written using Streamlit. ","archived":false,"fork":false,"pushed_at":"2020-09-30T01:29:25.000Z","size":10315,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-20T11:39:40.395Z","etag":null,"topics":["explainer","interpretability","lime","lime-explainer","nlp","streamlit","visualization","web-app"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prrao87.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-26T20:16:05.000Z","updated_at":"2024-12-09T15:48:17.000Z","dependencies_parsed_at":"2023-03-30T12:17:56.607Z","dependency_job_id":null,"html_url":"https://github.com/prrao87/fine-grained-sentiment-app-streamlit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prrao87%2Ffine-grained-sentiment-app-streamlit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prrao87%2Ffine-grained-sentiment-app-streamlit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prrao87%2Ffine-grained-sentiment-app-streamlit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prrao87%2Ffine-grained-sentiment-app-streamlit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prrao87","download_url":"https://codeload.github.com/prrao87/fine-grained-sentiment-app-streamlit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245802644,"owners_count":20674718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["explainer","interpretability","lime","lime-explainer","nlp","streamlit","visualization","web-app"],"created_at":"2024-10-08T05:40:28.946Z","updated_at":"2025-03-27T07:31:31.670Z","avatar_url":"https://github.com/prrao87.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Streamlit Explainer App for Fine Grained Sentiment Classification\n\nThis repo contains the Streamlit equivalent of an existing interactive application, that explains the results of fine-grained sentiment classification, described in detail in [this Medium Series](https://medium.com/@tech_optimist/fine-grained-sentiment-analysis-in-python-part-2-2a92fdc0160d).\n\nA number of classifiers are implemented and their results explained using the [LIME explainer](https://arxiv.org/pdf/1602.04938.pdf). \nThe classifers were trained on the  [Stanford Sentiment Treebank](https://nlp.stanford.edu/sentiment/) (SST-5) dataset. The class labels are any of `[1, 2, 3, 4, 5]`, where `1` is very negative and `5` is very positive. \n\n## Why Streamlit?\n[Streamlit](https://www.streamlit.io/) is a light-weight, minimalistic framework to build dashboards in Python. The main focus of Streamlit is to provide developers with the ability to rapidly prototype their UI designs using as few lines of code as possible. All the heavy lifting typically required to deploy a web application, such as defining the backend server and its routes, handling HTTP requests, etc., are abstracted away from the user. As a result, it becomes very easy to quickly implement a web app, regardless of the developer's experience.\n\n\n## Installation\n\nFirst, set up virtual environment and install from `requirements.txt`:\n\n    python3 -m venv venv\n    source venv/bin/activate\n    pip3 install -r requirements.txt\n\nFor further development, simply activate the existing virtual environment.\n\n    source venv/bin/activate\n\n\n## Usage\n\nAfter the virtual environment is set up and activated, run the app using the command below.\n\n```sh\nstreamlit run app.py\n```\n\nEnter a sentence, choose a type of classifier and click on the button `Explain results`. We can then observe the features (i.e. words or tokens) that contributed to the classifier predicting a particular class label.\n\n## Demo for the front-end\n\nThe front-end app takes in a text sample and outputs LIME explanations for the different methods. The app is is deployed using Heroku at this location: https://sst5-explainer-streamlit.herokuapp.com/\n\nPlay with your own text examples as shown below and see the fine-grained sentiment results explained!\n\n**NOTE:** Because the PyTorch-based models (Flair and the causal transformer) are quite expensive to run inference with (they require a GPU), these methods are not deployed. However, they can be run on a local instance of the app.\n\n![](./data/assets/sst5-streamlit-explainer.gif)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprrao87%2Ffine-grained-sentiment-app-streamlit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprrao87%2Ffine-grained-sentiment-app-streamlit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprrao87%2Ffine-grained-sentiment-app-streamlit/lists"}