ashrestha's picture
.
81b6ae4
raw
history blame
No virus
557 Bytes
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("Enter your sample")
input_label = st.text_input("Enter 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.markdown(pred)