File size: 578 Bytes
e7429d7
 
 
 
222f5e0
e7429d7
2199b57
e7429d7
2199b57
 
598a151
2199b57
598a151
 
 
 
 
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

st.title("Text Classifier - BART-Large-MNLI")
st.write("Input text and labels. Submit. The machine will classify the text according to the labels.")

classifier = pipeline(task="zero-shot-classification", device=0, model="facebook/bart-large-mnli")

input_text = st.text_input(label='Input Text')
labels = st.text_input(label='Labels')

if st.button("Submit"):
   labs = labels.title().split(',')
   text = input_text.title() 
   res = classifier(text, labs)
   st.success(res['labels'][0])
   st.info(res['scores'][0])