Update app.py
Browse files
app.py
CHANGED
|
@@ -12,13 +12,13 @@ import streamlit as st
|
|
| 12 |
import requests
|
| 13 |
import torch
|
| 14 |
|
| 15 |
-
st.markdown("## Prediction of
|
| 16 |
background = Image.open('logo.jpg')
|
| 17 |
st.image(background)
|
| 18 |
|
| 19 |
st.markdown(f"### Article URL")
|
| 20 |
text = st.text_area("Insert some url here",
|
| 21 |
-
value="https://
|
| 22 |
|
| 23 |
# @st.cache(allow_output_mutation=True)
|
| 24 |
# def get_models_and_tokenizers():
|
|
@@ -81,11 +81,11 @@ tokens_info = tokenizer(concated_text, truncation=True, return_tensors="pt")
|
|
| 81 |
with torch.no_grad():
|
| 82 |
raw_predictions = model(**tokens_info)
|
| 83 |
softmaxed = int(torch.nn.functional.softmax(raw_predictions.logits[0], dim=0)[1] * 100)
|
| 84 |
-
st.markdown("###
|
| 85 |
st.progress(softmaxed)
|
| 86 |
st.markdown(f"This is fake by *{softmaxed}%*!")
|
| 87 |
if (softmaxed > 70):
|
| 88 |
-
st.error('We would not trust this text!')
|
| 89 |
elif (softmaxed > 40):
|
| 90 |
st.warning('We are not sure about this text!')
|
| 91 |
else:
|
|
|
|
| 12 |
import requests
|
| 13 |
import torch
|
| 14 |
|
| 15 |
+
st.markdown("## Prediction of Misinformation by given URL")
|
| 16 |
background = Image.open('logo.jpg')
|
| 17 |
st.image(background)
|
| 18 |
|
| 19 |
st.markdown(f"### Article URL")
|
| 20 |
text = st.text_area("Insert some url here",
|
| 21 |
+
value="https://www.livelaw.in/news-updates/supreme-court-collegium-recommends-appointment-advocate-praveen-kumar-giri-judge-allahabad-high-court-279470")
|
| 22 |
|
| 23 |
# @st.cache(allow_output_mutation=True)
|
| 24 |
# def get_models_and_tokenizers():
|
|
|
|
| 81 |
with torch.no_grad():
|
| 82 |
raw_predictions = model(**tokens_info)
|
| 83 |
softmaxed = int(torch.nn.functional.softmax(raw_predictions.logits[0], dim=0)[1] * 100)
|
| 84 |
+
st.markdown("### Truthteller Predicts..")
|
| 85 |
st.progress(softmaxed)
|
| 86 |
st.markdown(f"This is fake by *{softmaxed}%*!")
|
| 87 |
if (softmaxed > 70):
|
| 88 |
+
st.error('We would not trust this text! This is misleading..')
|
| 89 |
elif (softmaxed > 40):
|
| 90 |
st.warning('We are not sure about this text!')
|
| 91 |
else:
|