import streamlit as st from transformers import pipeline print ("Load hv model...") # Load the pre-trained emotion classification pipeline model_name = "bhadresh-savani/distilbert-base-uncased-emotion" emotion_classifier = pipeline("text-classification", model=model_name) # Title and Description st.title("Emotion Classifier") st.write("""write down how your day went or what your mood is. On this space used model "bhadresh-savani/distilbert-base-uncased-emotion" """) # Input text box input_text = st.text_area("Enter text to analyze emotions:", "") if st.button("Classify Emotion"): if input_text.strip() == "": st.write("Please enter some text to classify.") else: # Get classification results results = emotion_classifier(input_text) st.subheader("Predicted Emotions:") for result in results: st.write(f"**{result['label']}**: {result['score']:.4f}")