Spaces:
Runtime error
Runtime error
import streamlit as st | |
from transformers import pipeline | |
st.title("Text Classifier - BART-Large-MNLI") | |
st.caption("Input text and labels. Submit. The machine will classify the text according to the labels.") | |
classifier = pipeline('zero-shot-classification') | |
form = st.form(key='zeroclassifier_form') | |
input_text = form.text_input(label='Input Text') | |
labels = form.text_input(label='Labels') | |
submit_button = form.form_submit_button(label='Submit') | |
if submit_button: | |
labs = labels.title().split(',') | |
text = input_text.title() | |
res = classifier(text, labs) | |
st.success(res['labels'][0]) | |
st.info(res['scores'][0]) | |