#importing the libraries needed #for the classification import streamlit as st import pandas as pd from transformers import pipeline #for the pre-processing of uploaded data import string #adding the css presentation from the styles file in utils from utils.styles import load_css load_css() #calling and loading the fine tuned model from the hugging face account @st.cache_resource def load_classifier(): return pipeline( "text-classification", model="SuchithTissera/text_analytics_model", truncation=True ) #adding stop word based on nlk library - look at limitations for the reason stop_words = {'most', "i've", 't', "we'll", 'mustn', 'we', 'into', 'they', 'on', "they'll", 'haven', 'after', 'had', 'myself', 'she', 'too', 'won', 'over', 'any', "you've", 'not', 'me', "they're", "wouldn't", 'other', 'have', 'once', 'yourselves', 'doing', 'mightn', 'been', "he'll", "she'll", 'the', "wasn't", 'to', 'further', "hadn't", "i'll", 'my', 'or', 'against', "doesn't", 'can', 'you', 'down', 'of', 'ain', 'below', 'these', "they'd", 'but', 'here', 'was', 'and', 'both', 'so', 'your', 'needn', 'has', "she's", 'as', "should've", 'very', 've', 'them', "aren't", "shouldn't", 'where', 'while', 'our', "mustn't", 'yourself', 'by', 'now', 'be', 'do', 'y', 'should', 'about', 'for', 'her', 'then', 'from', "isn't", "he'd", 'whom', 'herself', 'before', "he's", "you'd", 'm', "didn't", "we've", 'no', "hasn't", "needn't", 'off', 's', 'some', 'are', 'all', "weren't", "i'm", 'theirs', 'wasn', 'during', 'didn', "haven't", 'own', 'at', 'hasn', 'his', 'shan', "it's", 'just', 'ourselves', 'between', 'its', 'again', "she'd", 're', 'that', 'few', 'more', 'hadn', 'is', 'nor', "you'll", 'having', 'than', "i'd", 'only', 'aren', "you're", "couldn't", "won't", 'each', 'if', 'am', 'hers', 'what', 'weren', 'will', 'an', 'it', "they've", "shan't", "that'll", 'll', 'he', 'how', "we'd", 'did', 'isn', 'in', 'ma', 'o', 'themselves', "don't", 'shouldn', 'those', 'why', 'who', "we're", "it'd", 'wouldn', 'don', 'until', 'up', 'out', 'couldn', 'yours', "it'll", 'because', 'there', 'a', 'same', 'which', 'being', 'himself', 'under', 'through', 'when', "mightn't", 'ours', 'above', 'were', 'd', 'does', 'such', 'doesn', 'itself', 'this', 'i', 'their', 'with', 'him'} #constructing the stopwork function def remove_stopwords(text): return " ".join([word for word in str(text).lower().split() if word not in stop_words]) #saving the loaded model for convience in a variable classifier = load_classifier() #writing the text content in the page st.markdown('