Spaces:
Runtime error
Runtime error
Upload ReadMe_ForFinalExamNLPAPP.txt
Browse files
ReadMe_ForFinalExamNLPAPP.txt
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
NLP Image Quote Generator APP README
|
2 |
+
Overview
|
3 |
+
This project aims to classify textual data into emotion categories using various models, including RoBERTa, DistilBERT, and a Bag-of-Words (BoW) classifier.
|
4 |
+
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
|
5 |
+
stable diffusion.
|
6 |
+
|
7 |
+
This README provides instructions on setting up and running the code, along with the required libraries.
|
8 |
+
|
9 |
+
Prerequisites
|
10 |
+
Before running the code, ensure you have the following installed:
|
11 |
+
|
12 |
+
Python 3.6 or later
|
13 |
+
pip (Python Package Installer)
|
14 |
+
Required Libraries
|
15 |
+
The project relies on several Python librariesas follows:
|
16 |
+
|
17 |
+
from transformers import pipeline, RobertaTokenizer, RobertaForSequenceClassification
|
18 |
+
from sklearn.feature_extraction.text import CountVectorizer
|
19 |
+
from sklearn.naive_bayes import MultinomialNB
|
20 |
+
from sklearn.pipeline import make_pipeline
|
21 |
+
from datasets import load_dataset
|
22 |
+
from PIL import Image, ImageDraw, ImageFont
|
23 |
+
import textwrap
|
24 |
+
import random
|
25 |
+
from diffusers import StableDiffusionPipeline
|
26 |
+
import torch
|
27 |
+
from sklearn.metrics import classification_report, accuracy_score, f1_score
|
28 |
+
from sklearn.model_selection import train_test_split # Import train_test_split
|
29 |
+
import gradio as gr
|
30 |
+
|
31 |
+
Additionally, we must have access to two separate datasets from the huggingface.-
|
32 |
+
https://huggingface.co/datasets/dair-ai/emotion
|
33 |
+
https://huggingface.co/datasets/Abirate/english_quotes
|
34 |
+
|
35 |
+
Evaluation Metrics
|
36 |
+
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
|
37 |
+
it clean).
|