sentiment-test / app.py
ayoni02
NA VICTOR O
6b74b06
raw
history blame
689 Bytes
from transformers import pipeline
import streamlit as st
#from functions import classify
st.write("welcome")
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
#res = classify("i am a good boy")
#st.write(res)
def main():
text = st.text_input("Enter the text to classify: ") #input("Enter the text to classify: ")
labels = ["TOXIC", "AGGRESSIVE", "HATE SPEECH", "INSULTIVE", "SPAM", "NSFW" "NEUTRAL"]
if text:
results = classifier(text, labels)
#st.write(results['sequence'])
st.write(results['labels'])
st.write(results['scores'])
else:
st.write("Please enter some text to classify")
main()