Update app.py
Browse files
app.py
CHANGED
|
@@ -373,17 +373,6 @@ if "text_area" not in st.session_state:
|
|
| 373 |
|
| 374 |
url_text = st.text_input("Please Enter a url here")
|
| 375 |
|
| 376 |
-
if url_text:
|
| 377 |
-
article_title, cleaned_text = clean_text(url_text, url=True)
|
| 378 |
-
st.session_state.text_area = cleaned_text[0]
|
| 379 |
-
|
| 380 |
-
article_text = st.text_area(
|
| 381 |
-
label='Full Article Text',
|
| 382 |
-
placeholder="Full article text will be displayed here..",
|
| 383 |
-
height=250,
|
| 384 |
-
key='text_area'
|
| 385 |
-
)
|
| 386 |
-
|
| 387 |
st.markdown(
|
| 388 |
"<h3 style='text-align: center; color: red;'>OR</h3>",
|
| 389 |
unsafe_allow_html=True,
|
|
@@ -400,13 +389,24 @@ upload_doc = st.file_uploader(
|
|
| 400 |
"Upload a .txt, .pdf, .docx file for summarization"
|
| 401 |
)
|
| 402 |
|
| 403 |
-
if
|
| 404 |
-
|
| 405 |
st.session_state.text_area = cleaned_text[0]
|
| 406 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 407 |
elif upload_doc:
|
| 408 |
_, cleaned_text = clean_text(upload_doc,doc=True)
|
| 409 |
st.session_state.text_area = cleaned_text[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 410 |
|
| 411 |
summarize = st.button("Summarize")
|
| 412 |
|
|
|
|
| 373 |
|
| 374 |
url_text = st.text_input("Please Enter a url here")
|
| 375 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
st.markdown(
|
| 377 |
"<h3 style='text-align: center; color: red;'>OR</h3>",
|
| 378 |
unsafe_allow_html=True,
|
|
|
|
| 389 |
"Upload a .txt, .pdf, .docx file for summarization"
|
| 390 |
)
|
| 391 |
|
| 392 |
+
if url_text:
|
| 393 |
+
article_title, cleaned_text = clean_text(url_text, url=True)
|
| 394 |
st.session_state.text_area = cleaned_text[0]
|
| 395 |
|
| 396 |
+
elif plain_text:
|
| 397 |
+
_, cleaned_text = clean_text(plain_text,plain_text=True)
|
| 398 |
+
st.session_state.text_area = cleaned_text[0]
|
| 399 |
+
|
| 400 |
elif upload_doc:
|
| 401 |
_, cleaned_text = clean_text(upload_doc,doc=True)
|
| 402 |
st.session_state.text_area = cleaned_text[0]
|
| 403 |
+
|
| 404 |
+
article_text = st.text_area(
|
| 405 |
+
label='Full Article Text',
|
| 406 |
+
placeholder="Full article text will be displayed here..",
|
| 407 |
+
height=250,
|
| 408 |
+
key='text_area'
|
| 409 |
+
)
|
| 410 |
|
| 411 |
summarize = st.button("Summarize")
|
| 412 |
|