richardorama
commited on
Commit
β’
255e1d3
1
Parent(s):
f4ab10b
Update app.py
Browse files
app.py
CHANGED
@@ -100,6 +100,32 @@ else:
|
|
100 |
#st.warning('π Please enter Statement!')
|
101 |
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
################ TEXT TO SPEECH (TTS) - side bar - pipeline #################
|
104 |
|
105 |
|
@@ -132,31 +158,6 @@ if STATEMENT:
|
|
132 |
else:
|
133 |
st.sidebar.button('TTS', disabled=True)
|
134 |
#st.warning('π Please enter Statement!')
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
################ STATEMENT SUMMARIZATION - side bar - pipeline #################
|
139 |
-
|
140 |
-
# Load the summarization model
|
141 |
-
#summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6") # smaller version of the model
|
142 |
-
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
143 |
-
|
144 |
-
st.sidebar.markdown("<h3 style='text-align: center; font-size: 16px; background-color: white; color: black;'>Text Summarization - BART Pipeline</h3>", unsafe_allow_html=True)
|
145 |
-
DEFAULT_STATEMENT = ""
|
146 |
-
# Create a text area for user input
|
147 |
-
STATEMENT = st.sidebar.text_area('Enter Statement (String2)', DEFAULT_STATEMENT, height=150)
|
148 |
-
|
149 |
-
# Enable the button only if there is text in the SENTIMENT variable
|
150 |
-
if STATEMENT:
|
151 |
-
if st.sidebar.button('Summarize Statement2'):
|
152 |
-
# Call your Summarize function here
|
153 |
-
#st.write('\n\n')
|
154 |
-
summary = summarizer(STATEMENT, max_length=500, min_length=30, do_sample=False)
|
155 |
-
st.sidebar.write(summary[0]['summary_text'])
|
156 |
-
#summarize_statement(STATEMENT) # Directly pass the STATEMENT
|
157 |
-
else:
|
158 |
-
st.sidebar.button('Summarize Statement2', disabled=True)
|
159 |
-
#st.warning('π Please enter Statement!')
|
160 |
|
161 |
|
162 |
|
|
|
100 |
#st.warning('π Please enter Statement!')
|
101 |
|
102 |
|
103 |
+
|
104 |
+
################ STATEMENT SUMMARIZATION - side bar - pipeline #################
|
105 |
+
|
106 |
+
# Load the summarization model
|
107 |
+
#summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6") # smaller version of the model
|
108 |
+
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
109 |
+
|
110 |
+
st.sidebar.markdown("<h3 style='text-align: center; font-size: 16px; background-color: white; color: black;'>Text Summarization - BART Pipeline</h3>", unsafe_allow_html=True)
|
111 |
+
DEFAULT_STATEMENT = ""
|
112 |
+
# Create a text area for user input
|
113 |
+
STATEMENT = st.sidebar.text_area('Enter Statement (String2)', DEFAULT_STATEMENT, height=150)
|
114 |
+
|
115 |
+
# Enable the button only if there is text in the SENTIMENT variable
|
116 |
+
if STATEMENT:
|
117 |
+
if st.sidebar.button('Summarize Statement2'):
|
118 |
+
# Call your Summarize function here
|
119 |
+
#st.write('\n\n')
|
120 |
+
summary = summarizer(STATEMENT, max_length=500, min_length=30, do_sample=False)
|
121 |
+
st.sidebar.write(summary[0]['summary_text'])
|
122 |
+
#summarize_statement(STATEMENT) # Directly pass the STATEMENT
|
123 |
+
else:
|
124 |
+
st.sidebar.button('Summarize Statement2', disabled=True)
|
125 |
+
#st.warning('π Please enter Statement!')
|
126 |
+
|
127 |
+
|
128 |
+
|
129 |
################ TEXT TO SPEECH (TTS) - side bar - pipeline #################
|
130 |
|
131 |
|
|
|
158 |
else:
|
159 |
st.sidebar.button('TTS', disabled=True)
|
160 |
#st.warning('π Please enter Statement!')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
|
162 |
|
163 |
|