Spaces:
Sleeping
Sleeping
File size: 602 Bytes
4640981 4ed96bc 4640981 4ed96bc 4640981 4ed96bc 4640981 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import streamlit as st
from transformers import pipeline
classifier = pipeline("sentiment-analysis", model="michellejieli/emotion_text_classifier")
st.title("Emotion in Text Classifier")
st.write("Enter any sentence, and the model will predict the expressed emotion in it!")
user_input = st.text_area("Type your prompt here.", "...")
if st.button("Predict Emotion"):
result = classifier(user_input)
emotion = result[0]['label']
score = result[0]['score']
st.write(f"**Predicted Emotion:** {emotion}")
st.write(f"**Confidence Score:** {score:.2f}")
|