Spaces:
Sleeping
Sleeping
File size: 1,145 Bytes
4a1a5d4 4229c22 4a1a5d4 6b1cdde 4a1a5d4 6b1cdde 4a1a5d4 912bca4 4a1a5d4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import streamlit as st
from transformers import pipeline
# Load the text classification model pipeline
classifier = pipeline("text-classification", model='djohari/EmployeeEmotionAnalysis', return_all_scores=True)
# Streamlit application title
st.title("Emotion Classification for Employee Reviews")
st.write("Classification for 6 emotions: sadness, joy, love, anger, fear, surprise")
st.write("Please note: this is a model for Text Classification and can only work with input text")
# Text input for user to enter the text to classify
text = st.text_area("Add your Employee Reviews in the box to classify", "")
# Perform text classification when the user clicks the "Classify" button
if st.button("Classify Emotion"):
# Perform text classification on the input text
results = classifier(text)[0]
# Display the classification result
max_score = float('-inf')
max_label = ''
for result in results:
if result['score'] > max_score:
max_score = result['score']
max_label = result['label']
st.write("Text:", text)
st.write("Label:", max_label)
st.write("Score:", max_score) |