Spaces:
Runtime error
Runtime error
File size: 577 Bytes
1a80035 8f8b328 81b6ae4 4791a7a 81b6ae4 1a80035 79b6ab8 8f8b328 79b6ab8 8f8b328 4791a7a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import streamlit as st
from transformers import pipeline
classifier = pipeline("zero-shot-classification",
model="valhalla/distilbart-mnli-12-1")
with st.form('inputs'):
input_text = st.text_area("Input text")
input_label = st.text_input("Labels", placeholder="support, help, important")
submit_button = st.form_submit_button(label='Submit')
if submit_button:
labels = list(l.strip() for l in input_label.split(','))
pred = classifier(input_text, labels, multi_class=True)
st.success(pred['label'])
# st.markdown(pred)
|