Spaces:
Runtime error
Runtime error
import streamlit as st | |
from transformers import pipeline | |
# Load the text classification model pipeline | |
classifier = pipeline("text-classification",model='wxrrrrrrr/finetunde_sentiment_analysis', return_all_scores=True) | |
# Streamlit application title | |
st.title("Text Sentiment") | |
st.write("Analysis for 2 emotions: love, anger") | |
# Text input for user to enter the text to classify | |
text = st.text_area("Enter the text to analysis", "") | |
# Perform text classification when the user clicks the "Classify" button | |
if st.button("Analysis"): | |
# 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) |