File size: 1,990 Bytes
0b1144c
 
 
 
 
e5b0a02
5e7ba30
 
e5b0a02
5e7ba30
 
0b1144c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5e7ba30
0b1144c
 
 
 
 
 
 
 
 
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import streamlit as st
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
import tensorflow as tf
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)


# tokenizer = AutoTokenizer.from_pretrained("cardiffnlp/twitter-xlm-roberta-base-sentiment")
# model = AutoModelForSequenceClassification.from_pretrained("cardiffnlp/twitter-xlm-roberta-base-sentiment")

# # Load pre-trained model and tokenizer
nlp = pipeline("text-classification", model="cardiffnlp/twitter-xlm-roberta-base-sentiment")

# Define function to analyze sentiment
def analyze_sentiment(text):
    result = nlp(text)
    return result[0]['label'], result[0]['score']

# Streamlit UI
st.set_page_config(page_title="Sentiment Analysis", layout="wide")
col1, col2 = st.columns([6, 1])  # Divide the screen into two columns



with col2:  # Right-aligned column for the logo
    st.image("https://huggingface.co/spaces/orYx-models/Leadership-sentiment-analyzer/resolve/main/oryx_logo%20(2).png", width=200, use_column_width=False)  # Provide the path to your company logo

with col1:  # Main content area

    # Text titles below the text box
    st.markdown("This sentiment analysis model serves as a testing prototype, specifically developed for LDS to assess the variability and precision of OrYx Models' sentiment analysis tool.")
    st.markdown(" ")     
    st.markdown("All feedback gathered from LDS, including both structured and unstructured data, will be incorporated into the model to enhance its domain specificity and maximize accuracy.")

    
    st.title("Sentiment Analysis Prototype Tool by orYx Models (De)")
    user_input = st.text_area("Enter text to analyze:", height=200)
    
    submit_button = st.button("Analyze")

    if submit_button and user_input:
        sentiment, score = analyze_sentiment(user_input)
        st.markdown("Sentiment Analysis Result:")
        st.write(f"Sentiment:  {sentiment}")
        st.write(f"Confidence:  {score*100:.2f}%")