Spaces:
Sleeping
Sleeping
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}") | |