Spaces:
Sleeping
Sleeping
File size: 697 Bytes
be86868 99b17f2 5a8c11f 4326ebc 34d4d45 9b0d5c8 f18c254 8a8dc07 f18c254 6aacc74 f18c254 70330b3 99b17f2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
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() |