Update app.py
Browse files
app.py
CHANGED
|
@@ -36,8 +36,28 @@ user_input = st.text_input("Article URL")
|
|
| 36 |
m = st.markdown("""
|
| 37 |
<style>
|
| 38 |
div.stButton > button:first-child {
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
</style>""", unsafe_allow_html=True)
|
| 42 |
|
| 43 |
submit = st.button("submit")
|
|
@@ -76,15 +96,13 @@ if submit:
|
|
| 76 |
).flatten()
|
| 77 |
sorted = np.argsort(similarity_score)[::-1].tolist()
|
| 78 |
|
| 79 |
-
st.markdown(f"<small>Compute Finished in {int(time.time() - last_time)} seconds</small>", unsafe_allow_html=True)
|
| 80 |
prediction = np.argmax(result, axis=-1)
|
| 81 |
if prediction == 0:
|
| 82 |
st.success(f"This news is {label[prediction]}.")
|
| 83 |
else:
|
| 84 |
st.error(f"This news is {label[prediction]}.")
|
| 85 |
|
| 86 |
-
st.
|
| 87 |
-
st.progress(result[prediction])
|
| 88 |
|
| 89 |
with st.expander("Related Articles"):
|
| 90 |
for i in sorted[:5]:
|
|
|
|
| 36 |
m = st.markdown("""
|
| 37 |
<style>
|
| 38 |
div.stButton > button:first-child {
|
| 39 |
+
background-color: #ce1126;
|
| 40 |
+
color: white;
|
| 41 |
+
height: 3em;
|
| 42 |
+
width: 12em;
|
| 43 |
+
border-radius:10px;
|
| 44 |
+
border:3px solid #000000;
|
| 45 |
+
font-size:20px;
|
| 46 |
+
font-weight: bold;
|
| 47 |
+
margin: auto;
|
| 48 |
+
display: block;
|
| 49 |
}
|
| 50 |
+
|
| 51 |
+
div.stButton > button:hover {
|
| 52 |
+
background:linear-gradient(to bottom, #ce1126 5%, #ff5a5a 100%);
|
| 53 |
+
background-color:#ce1126;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
div.stButton > button:active {
|
| 57 |
+
position:relative;
|
| 58 |
+
top:3px;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
</style>""", unsafe_allow_html=True)
|
| 62 |
|
| 63 |
submit = st.button("submit")
|
|
|
|
| 96 |
).flatten()
|
| 97 |
sorted = np.argsort(similarity_score)[::-1].tolist()
|
| 98 |
|
|
|
|
| 99 |
prediction = np.argmax(result, axis=-1)
|
| 100 |
if prediction == 0:
|
| 101 |
st.success(f"This news is {label[prediction]}.")
|
| 102 |
else:
|
| 103 |
st.error(f"This news is {label[prediction]}.")
|
| 104 |
|
| 105 |
+
st.markdown(f"""<small style:"align:center;">{int(result[prediction]*100)}% confidence</small>""")
|
|
|
|
| 106 |
|
| 107 |
with st.expander("Related Articles"):
|
| 108 |
for i in sorted[:5]:
|