|
import streamlit as st |
|
from transformers import pipeline |
|
|
|
|
|
classifier = pipeline("text-classification", model='ISOM52402024Gr6/Sentiment_Model_Amazon', return_all_scores=True) |
|
|
|
|
|
st.title("Text Classification") |
|
st.write("Classification for emotions: neutral, entailment") |
|
|
|
|
|
text = st.text_area("Enter the text to classify", "") |
|
|
|
|
|
if st.button("Classify"): |
|
|
|
results = classifier(text)[0] |
|
|
|
|
|
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) |