ImageQuoteGenerator / ReadMe_ForFinalExamNLPAPP.txt
Nandoguer's picture
Upload ReadMe_ForFinalExamNLPAPP.txt
17104d0 verified
NLP Image Quote Generator APP README
Overview
This project aims to classify textual data into emotion categories using various models, including RoBERTa, DistilBERT, and a Bag-of-Words (BoW) classifier.
Once the emotion has been categorized it uses said emotion to bring a quote from a different dataset than the one used for training and an image from
stable diffusion.
This README provides instructions on setting up and running the code, along with the required libraries.
Prerequisites
Before running the code, ensure you have the following installed:
Python 3.6 or later
pip (Python Package Installer)
Required Libraries
The project relies on several Python librariesas follows:
from transformers import pipeline, RobertaTokenizer, RobertaForSequenceClassification
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.pipeline import make_pipeline
from datasets import load_dataset
from PIL import Image, ImageDraw, ImageFont
import textwrap
import random
from diffusers import StableDiffusionPipeline
import torch
from sklearn.metrics import classification_report, accuracy_score, f1_score
from sklearn.model_selection import train_test_split # Import train_test_split
import gradio as gr
Additionally, we must have access to two separate datasets from the huggingface.-
https://huggingface.co/datasets/dair-ai/emotion
https://huggingface.co/datasets/Abirate/english_quotes
Evaluation Metrics
The code evaluates the models based on accuracy, precision, recall, and F1 score. The results are printed out on the script but not the gradio site (to keep
it clean).