This project is designed to perform sentiment analysis on textual data. It includes a machine learning model for predicting sentiment, a web interface for user interaction, and a backend to handle prediction requests.
The demo app is running on HuggingFace Spaces - https://huggingface.co/spaces/lyrisha/sentiment-analysis
Detailed description of this project, including accuracy results on tested datasets can be found on my blog
- Show how to use HuggingFace pre-trained model and Transformers library to fine-tune it to the specific task of sentiment analysis.
- Show how to integrate a sentiment analysis model with a Gradio web application.
model_trainer.py: Contains theModelTrainerclass that loads user specified base model and trains the model with user specified dataset. The trained model is saved into HuggingFace model library.
model_predictor.py: Contains theModelPredictorclass that loads a pre-trained sentiment analysis model and provides a method for making predictions on new text data.
- example how to use pre-trained model from Hugging Face
- example how to make inference on custom fine-tuned model
app.py: The runner for demo. This script initializes the web application with Gradio library.ui.py: Handles the user interface aspects of the application. Generating and managing the HTML content returned to the user.
- Clone the repository to your local machine.
git clone git@github.com:kanovotn/sentiment-analysis-model-trainer.git- Ensure you have Python 3.6+ installed.
- Install the required dependencies:
pip install -r requirements.txtFor example how to fine-tune sentiment classificator refer to example notebook for fine-tunning
For example how to evaluate your transformer based model refer to notebook for inference and evaluation