Spaces:
Runtime error
Runtime error
import streamlit as st | |
from transformers import pipeline | |
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli") | |
st.title("What's the category?") | |
text = st.text_input("Enter words") | |
if text is not None: | |
candidate_labels = ['lifestyle', 'technology', 'entertainment', 'news'] | |
res = classifier(text, candidate_labels) | |
for index, name in enumerate(res['labels']): | |
st.text(f"{name} : {round(res['scores'][index], 3) * 100}%") |