File size: 570 Bytes
7840062
 
 
 
156dcad
7c09720
7840062
e21871c
7840062
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import streamlit as st
from transformers import pipeline
import gc

st.header("Sentiment Analyzer - BART-Large-MNLI")
st.write("Input text and press control + enter. The machine will present the likelihood that the text can be categorized as positive, negative and neutral.")

classifier = pipeline("zero-shot-classification", model='facebook/bart-large-mnli')

text = st.text_area("Input text and press control + enter.")
candidate_labels = ['positive', 'negative', 'neutral']

if text:
  out = classifier(text, candidate_labels)
  st.json(out)
  del out
  gc.collect()