Update app.py
Browse files
app.py
CHANGED
@@ -64,11 +64,6 @@ if submit:
|
|
64 |
]
|
65 |
|
66 |
print (f'\nresult: {result}')
|
67 |
-
input_column.markdown(f"<small>Compute Finished in {int(time.time() - last_time)} seconds</small>", unsafe_allow_html=True)
|
68 |
-
prediction = np.argmax(result, axis=-1)
|
69 |
-
input_column.success(f"This news is {label[prediction]}.")
|
70 |
-
st.text(f"{int(result[prediction]*100)}% confidence")
|
71 |
-
input_column.progress(result[prediction])
|
72 |
|
73 |
with st.spinner("Searching for references"):
|
74 |
title_embeddings = base_model.encode(title)
|
@@ -77,11 +72,17 @@ if submit:
|
|
77 |
data["embeddings"]
|
78 |
).flatten()
|
79 |
sorted = np.argsort(similarity_score)[::-1].tolist()
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
]
|
65 |
|
66 |
print (f'\nresult: {result}')
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
with st.spinner("Searching for references"):
|
69 |
title_embeddings = base_model.encode(title)
|
|
|
72 |
data["embeddings"]
|
73 |
).flatten()
|
74 |
sorted = np.argsort(similarity_score)[::-1].tolist()
|
75 |
+
|
76 |
+
input_column.markdown(f"<small>Compute Finished in {int(time.time() - last_time)} seconds</small>", unsafe_allow_html=True)
|
77 |
+
prediction = np.argmax(result, axis=-1)
|
78 |
+
input_column.success(f"This news is {label[prediction]}.")
|
79 |
+
input_column.text(f"{int(result[prediction]*100)}% confidence")
|
80 |
+
input_column.progress(result[prediction])
|
81 |
+
|
82 |
+
for i in sorted[:5]:
|
83 |
+
reference_column.write(f"""
|
84 |
+
<a href={data["url"][i]}><small>turnbackhoax.id</small></a>
|
85 |
+
<h5>{data["title"][i]}</h5>
|
86 |
+
""", unsafe_allow_html=True)
|
87 |
+
with reference_column.expander("read content"):
|
88 |
+
st.write(data["text"][i])
|