File size: 689 Bytes
7db39be
 
 
 
 
 
 
 
 
 
 
 
6b74b06
7db39be
 
6b74b06
7db39be
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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()