File size: 2,237 Bytes
20240f4
 
 
dae6881
ed4a54d
dae6881
 
 
 
 
 
ed4a54d
 
 
dae6881
ed4a54d
 
 
 
dae6881
ed4a54d
 
 
 
 
dae6881
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ced0847
 
 
 
dae6881
 
ced0847
 
 
 
 
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
45
46
47
48
49
50
51
52
import streamlit as st
from transformers import pipeline

pipe = pipeline('sentiment-analysis')

# Set the title and add introductory text
st.title("Sentiment Analysis App")
st.write("This simple app analyzes the sentiment of your text.")

# Use 'form' to group input elements together
with st.form("sentiment_form"):
    # Input for text to analyze sentiment
    text = st.text_area("Enter text for sentiment analysis:")

    # Add a button with a label
    submit_button = st.form_submit_button("Analyze Sentiment")

# Check if the form was submitted
if text and submit_button:
    # Analyze sentiment
    out = pipe(text)
    result = out[0]  # Assuming you want the first result if multiple are returned
    sentiment = result["label"]
    score = round(result["score"], 2)  # Round the score to two decimal places

    # Display sentiment analysis results
    st.header("Sentiment Analysis Result")
    st.write(f"**Sentiment**: {sentiment}")
    st.write(f"**Sentiment Score**: {score}")

# Add a section for instructions on how to use the app
st.header("How to Use")
st.write("1. Enter text in the text area above.")
st.write("2. Click the 'Analyze Sentiment' button to analyze the sentiment.")
st.write("3. The sentiment label and score will be displayed below.")

# Add a section with information about the sentiment analysis model
st.header("About the Model")
st.write("The sentiment analysis is performed using the Hugging Face Transformers library.")
st.write("The model used is 'nlptown/bert-base-multilingual-uncased-sentiment'.")

# Footer with additional information or links
st.markdown("For more information, visit the [Hugging Face Transformers website](https://huggingface.co/transformers/).")


# Footer with a link to  LinkedIn profile
st.header("Connect with Me on LinkedIn")
st.write("Feel free to reach out for any inquiries, collaborations, or just to connect.")
st.write("Visit my LinkedIn profile:")
linkedin_link = "https://www.linkedin.com/in/iam-manoj/"
linkedin_logo = "https://content.linkedin.com/content/dam/me/business/en-us/amp/brand-site/v2/bg/LI-Logo.svg.original.svg"
st.markdown(f'<a href="{linkedin_link}"><img src="{linkedin_logo}" alt="LinkedIn Logo" width="100"></a>', unsafe_allow_html=True)