import streamlit as st from transformers import pipeline import gc st.header("Sentiment-demo-app") st.subheader("Please be patient and wait up to a minute until the demo app is loaded.") st.caption("This is a very simple demo application for a zero-shot classification pipeline to classify positive, neutral, or negative sentiment for a short text. Enter your text in the box below and press CTRl+ENTER to run the model.") classifier = pipeline("zero-shot-classification", model='facebook/bart-large-mnli') text = st.text_area('Enter text here!') candidate_labels = ['Positive', 'Neutral', 'Negative'] if text: out = classifier(text, candidate_labels) st.json(out) del out gc.collect()