ikoghoemmanuell
commited on
Commit
·
bfd452f
1
Parent(s):
64b7e2b
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
import streamlit as st
|
2 |
import transformers
|
3 |
import torch
|
|
|
|
|
4 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
5 |
from predict_function import detect_fake_news
|
6 |
|
@@ -55,18 +57,13 @@ if choice == 'Home':
|
|
55 |
if text:
|
56 |
with st.spinner('Checking if news is Fake...'):
|
57 |
label, score = detect_fake_news(text)
|
58 |
-
print(label, score)
|
59 |
if label == "LABEL_1":
|
60 |
st.error(f"The text is likely to be fake news with a confidence score of {score*100:.2f}%!")
|
61 |
else:
|
62 |
st.success(f"The text is likely to be genuine with a confidence score of {score*100:.2f}%!")
|
63 |
else:
|
64 |
with st.spinner('Checking if news is Fake...'):
|
65 |
-
|
66 |
-
try:
|
67 |
-
st.success(f"")
|
68 |
-
except ValueError as e:
|
69 |
-
st.error(str(e))
|
70 |
|
71 |
|
72 |
|
|
|
1 |
import streamlit as st
|
2 |
import transformers
|
3 |
import torch
|
4 |
+
import requests
|
5 |
+
from PIL import Image
|
6 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
7 |
from predict_function import detect_fake_news
|
8 |
|
|
|
57 |
if text:
|
58 |
with st.spinner('Checking if news is Fake...'):
|
59 |
label, score = detect_fake_news(text)
|
|
|
60 |
if label == "LABEL_1":
|
61 |
st.error(f"The text is likely to be fake news with a confidence score of {score*100:.2f}%!")
|
62 |
else:
|
63 |
st.success(f"The text is likely to be genuine with a confidence score of {score*100:.2f}%!")
|
64 |
else:
|
65 |
with st.spinner('Checking if news is Fake...'):
|
66 |
+
st.warning("Please enter some text to detect fake news.")
|
|
|
|
|
|
|
|
|
67 |
|
68 |
|
69 |
|