sahibnanda's picture
commit app.py
ca0e178 verified
raw
history blame contribute delete
No virus
2.66 kB
import streamlit as st
from textFunctionality import generateText, modelWG, modelWOG, modelParaphrase
# Set the page configuration and theme once at the top
st.set_page_config(page_title="Text Summarization and Paraphrasing", page_icon="⭐")
st.write(
"""
<style>
.reportview-container {
background-color: #f8f9fa;
}
.sidebar .sidebar-content {
background-color: #f0f2f6;
}
h1 {
color: #0cdec0;
}
.stButton > button {
background-color: #38d6c0; /* Lighter teal shade */
color: black;
font-weight: bold;
transition: background-color 0.3s, color 0.3s;
}
.stButton > button:hover {
background-color: #01947f; /* Even lighter teal for hover */
color: white; /* Change text color on hover */
}
.stTextArea > textarea {
background-color: #ffffff;
color: #333;
}
</style>
""", unsafe_allow_html=True
)
def main():
st.title('Text Summarization and Paraphrasing')
st.write("**Summarize Without Grammar Performs Better But Misses Out On Grammar Like Punctuation, Capitalization, etc.**")
st.write("**This App Works Better For Long Texts.**")
# Text area for user input
user_input = st.text_area("#### **Enter Text To Summarize or Paraphrase**:", height=300)
# Layout for buttons in a single row using columns
col1, col2, col3 = st.columns(3)
with col1:
if st.button("Summarize With Grammar"):
if user_input:
summary = generateText(user_input, modelWG, 200, False)
st.session_state['output'] = "#### **Summarized Text (With Grammar)**:\n" + summary
else:
st.session_state['output'] = "**Please Enter Some Text To Summarize.**"
with col2:
if st.button("Summarize Without Grammar"):
if user_input:
summary = generateText(user_input, modelWOG, 200, True)
st.session_state['output'] = "#### **Summarized Text (Without Grammar)**:\n" + summary
else:
st.session_state['output'] = "**Please Enter Some Text To Summarize.**"
with col3:
if st.button("Paraphrase"):
if user_input:
paraphrase = generateText(user_input, modelParaphrase, 500, False)
st.session_state['output'] = "#### **Paraphrased Text**:\n" + paraphrase
else:
st.session_state['output'] = "**Please Enter Some Text To Paraphrase.**"
# Output display
if 'output' in st.session_state:
st.write(st.session_state['output'])
if __name__ == '__main__':
main()