File size: 2,662 Bytes
d9579cb
9098297
d9579cb
 
9098297
d9579cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0fe1c21
9098297
ca0e178
d9579cb
 
9098297
d9579cb
0fe1c21
 
 
 
 
 
 
 
 
9098297
0fe1c21
 
 
 
 
 
 
9098297
0fe1c21
 
 
 
 
 
 
 
 
 
 
d9579cb
 
0fe1c21
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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()