Rifky commited on
Commit
642f8d5
·
1 Parent(s): 155dcfa

Update app.py

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