import pandas as pd
import streamlit as st
from streamlit_text_rating.st_text_rater import st_text_rater
from sentiment import classify_sentiment
st.set_page_config( # Alternate names: setup_page, page, layout
layout="wide", # Can be "centered" or "wide". In the future also "dashboard", etc.
initial_sidebar_state="auto", # Can be "auto", "expanded", "collapsed"
page_title='None', # String or None. Strings get appended with "• Streamlit".
)
padding_top = 0
st.markdown(f"""
""",
unsafe_allow_html=True,
)
def set_page_title(title):
st.sidebar.markdown(unsafe_allow_html=True, body=f"""
""")
set_page_title('NLP use cases')
# Hide Menu Option
hide_streamlit_style = """
"""
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
st.title("NLP use cases")
with st.sidebar:
st.title("NLP tasks")
select_task=st.selectbox(label="Select task from drop down menu",
options=['Detect Sentiment','Zero Shot Classification'])
if select_task=='Detect Sentiment':
st.header("You are now performing Sentiment Analysis")
input_texts = st.text_input(label="Input texts separated by comma")
if input_texts!='':
sentiments = classify_sentiment(input_texts)
for i,t in enumerate(input_texts.split(',')):
if sentiments[i]=='Positive':
response=st_text_rater(t + f"--> This statement is {sentiments[i]}",
color_background='rgb(154,205,50)',key=t)
else:
response = st_text_rater(t + f"--> This statement is {sentiments[i]}",
color_background='rgb(233, 116, 81)',key=t)