File size: 590 Bytes
35f56ba
47ef74f
 
d71bb22
47ef74f
e43f53b
47ef74f
 
 
c704d04
 
47ef74f
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import streamlit as st
from transformers import pipeline
# import numpy as np

classifier = pipeline(task="sentiment-analysis")

textIn = st.text_input("Input Text Here:", "I really like the color of your car!")

option = st.selectbox('Which pre-trained model would you like for your sentiment analysis?',('TensorFlow', 'PyTorch', 'JAX'))

st.write('You selected:', option)

# pipeline
preds = classifier(textIn)
preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
st.write('Input text is ', preds[0]['label'], ' with a confidence of ', preds[0]['score'])