File size: 738 Bytes
f2a367d
a793ade
 
e115552
a793ade
 
 
e115552
a793ade
 
f2a367d
 
a793ade
643be30
89e0900
a793ade
 
 
 
 
 
 
e115552
 
0259538
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
import streamlit as st
from transformers import pipeline

model_path = "citizenlab/twitter-xlm-roberta-base-sentiment-finetunned"

st.set_page_config(page_title="Sentiment Analysis App")


sentiment_classifier = pipeline("text-classification", model=model_path, tokenizer=model_path)

st.title("Sentiment Analysis App")

user_input = st.text_area("Enter a message:")

if st.button("Analyze Sentiment"):
    if user_input:
        # Perform sentiment analysis
        results = sentiment_classifier(user_input)
        sentiment_label = results[0]["label"]
        sentiment_score = results[0]["score"]

        st.write(f"Sentiment: {sentiment_label}")
        st.write(f"Confidence Score: {sentiment_score:.2f}")

# Run the Streamlit app