Spaces:
Build error
Build error
Create app.py
Browse files1234567891011121314151617181920212223import streamlit as stfrom transformers import pipeline# Load the text classification model pipelineclassifier = pipeline("text-classification", model='isom5240sp24/bert-base-uncased-emotion', return_all_scores=True)# Streamlit application titlest.title("Text Classification")st.write("Classification for 6 emotions: sadness, joy, love, anger, fear, surprise")# Text input for user to enter the text to classifytext = st.text_area("Enter the text to classify", "")# Perform text classification when the user clicks the "Classify" buttonif st.button("Classify"):# Perform text classification on the input textresults = classifier(text)[0]# Display the classification resultmax_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_scoreapp.pyAdded+23