Update app.py
Browse files
app.py
CHANGED
@@ -48,9 +48,9 @@ if submit:
|
|
48 |
last_time = time.time()
|
49 |
with st.spinner("Reading Article..."):
|
50 |
scrap = Scrap(user_input)
|
51 |
-
title, text = scrap.title, scrap.text
|
52 |
|
53 |
-
if
|
|
|
54 |
text = re.sub(r'\n', ' ', text)
|
55 |
|
56 |
with st.spinner("Computing..."):
|
@@ -80,8 +80,8 @@ if submit:
|
|
80 |
|
81 |
prediction = np.argmax(result, axis=-1)
|
82 |
if prediction == 0:
|
83 |
-
st.markdown(f"""<p style="background-color: rgb(
|
84 |
-
color: rgb(
|
85 |
font-size: 20px;
|
86 |
border-radius: 7px;
|
87 |
padding-left: 12px;
|
@@ -90,8 +90,8 @@ if submit:
|
|
90 |
line-height: 25px;
|
91 |
text-align: center;">This article is <b>{label[prediction]}</b>.</p>""", unsafe_allow_html=True)
|
92 |
else:
|
93 |
-
st.markdown(f"""<p style="background-color: rgb(
|
94 |
-
color: rgb(
|
95 |
font-size: 20px;
|
96 |
border-radius: 7px;
|
97 |
padding-left: 12px;
|
@@ -99,6 +99,7 @@ if submit:
|
|
99 |
padding-bottom: 15px;
|
100 |
line-height: 25px;
|
101 |
text-align: center;">This article is <b>{label[prediction]}</b>.</p>""", unsafe_allow_html=True)
|
|
|
102 |
|
103 |
with st.expander("Related Articles"):
|
104 |
for i in sorted[:5]:
|
@@ -106,4 +107,14 @@ if submit:
|
|
106 |
st.markdown(f"""
|
107 |
<small style="text-align: left;">{data["url"][i].split("/")[2]}</small><br>
|
108 |
<a href={data["url"][i]} style="text-align: left;">{data["title"][i]}</a>
|
109 |
-
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
last_time = time.time()
|
49 |
with st.spinner("Reading Article..."):
|
50 |
scrap = Scrap(user_input)
|
|
|
51 |
|
52 |
+
if scrap:
|
53 |
+
title, text = scrap.title, scrap.text
|
54 |
text = re.sub(r'\n', ' ', text)
|
55 |
|
56 |
with st.spinner("Computing..."):
|
|
|
80 |
|
81 |
prediction = np.argmax(result, axis=-1)
|
82 |
if prediction == 0:
|
83 |
+
st.markdown(f"""<p style="background-color: rgb(236, 253, 245);
|
84 |
+
color: rgb(6, 95, 70);
|
85 |
font-size: 20px;
|
86 |
border-radius: 7px;
|
87 |
padding-left: 12px;
|
|
|
90 |
line-height: 25px;
|
91 |
text-align: center;">This article is <b>{label[prediction]}</b>.</p>""", unsafe_allow_html=True)
|
92 |
else:
|
93 |
+
st.markdown(f"""<p style="background-color: rgb(254, 242, 242);
|
94 |
+
color: rgb(153, 27, 27);
|
95 |
font-size: 20px;
|
96 |
border-radius: 7px;
|
97 |
padding-left: 12px;
|
|
|
99 |
padding-bottom: 15px;
|
100 |
line-height: 25px;
|
101 |
text-align: center;">This article is <b>{label[prediction]}</b>.</p>""", unsafe_allow_html=True)
|
102 |
+
|
103 |
|
104 |
with st.expander("Related Articles"):
|
105 |
for i in sorted[:5]:
|
|
|
107 |
st.markdown(f"""
|
108 |
<small style="text-align: left;">{data["url"][i].split("/")[2]}</small><br>
|
109 |
<a href={data["url"][i]} style="text-align: left;">{data["title"][i]}</a>
|
110 |
+
""", unsafe_allow_html=True)
|
111 |
+
else:
|
112 |
+
st.markdown(f"""<p style="background-color: rgb(254, 242, 242);
|
113 |
+
color: rgb(153, 27, 27);
|
114 |
+
font-size: 20px;
|
115 |
+
border-radius: 7px;
|
116 |
+
padding-left: 12px;
|
117 |
+
padding-top: 15px;
|
118 |
+
padding-bottom: 15px;
|
119 |
+
line-height: 25px;
|
120 |
+
text-align: center;">Can't scrap article from this link.</p>""", unsafe_allow_html=True)
|