Update pages/Website_Summarize.py
Browse files
pages/Website_Summarize.py
CHANGED
@@ -46,6 +46,7 @@ with st.container():
|
|
46 |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36'
|
47 |
}
|
48 |
|
|
|
49 |
## ............................................... ##
|
50 |
if st.button("Fetch article"):
|
51 |
article_url = url
|
@@ -53,9 +54,7 @@ with st.container():
|
|
53 |
|
54 |
try:
|
55 |
response_ = session.get(article_url, headers=headers_, timeout=10)
|
56 |
-
|
57 |
if response_.status_code == 200:
|
58 |
-
|
59 |
with st.spinner('Fetching your article...'):
|
60 |
time.sleep(3)
|
61 |
st.success('Your article is ready for summarization!')
|
@@ -118,9 +117,13 @@ with st.container():
|
|
118 |
|
119 |
# Query the API Summary
|
120 |
output_sum = query_sum({"inputs": text, })
|
121 |
-
|
122 |
-
|
123 |
-
|
|
|
|
|
|
|
|
|
124 |
|
125 |
st.divider()
|
126 |
st.subheader("Summary AI")
|
|
|
46 |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36'
|
47 |
}
|
48 |
|
49 |
+
st.markdown("You need to Fetch Article first, and then Submit to Summarize.")
|
50 |
## ............................................... ##
|
51 |
if st.button("Fetch article"):
|
52 |
article_url = url
|
|
|
54 |
|
55 |
try:
|
56 |
response_ = session.get(article_url, headers=headers_, timeout=10)
|
|
|
57 |
if response_.status_code == 200:
|
|
|
58 |
with st.spinner('Fetching your article...'):
|
59 |
time.sleep(3)
|
60 |
st.success('Your article is ready for summarization!')
|
|
|
117 |
|
118 |
# Query the API Summary
|
119 |
output_sum = query_sum({"inputs": text, })
|
120 |
+
|
121 |
+
if output_sum:
|
122 |
+
# Check if the dictionary is not empty
|
123 |
+
summary = output_sum[0].get('summary_text', '').replace('<n>', " ")
|
124 |
+
else:
|
125 |
+
# Handle the case where the dictionary is empty or doesn't have 'summary_text'
|
126 |
+
summary = "Summary not available"
|
127 |
|
128 |
st.divider()
|
129 |
st.subheader("Summary AI")
|