Snehangshu2002
commited on
Commit
•
5675707
1
Parent(s):
59ac781
Upload 5 files
Browse files- app.py +40 -0
- logistic_regression_model.pkl +3 -0
- requirements.txt +176 -0
- vectorizer_text.pkl +3 -0
- vectorizer_title.pkl +3 -0
app.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pickle
|
3 |
+
import numpy as np
|
4 |
+
|
5 |
+
|
6 |
+
with open("Model/vectorizer_text.pkl", "rb") as f:
|
7 |
+
vectorizer_text = pickle.load(f)
|
8 |
+
|
9 |
+
with open("Model/vectorizer_title.pkl", "rb") as f:
|
10 |
+
vectorizer_title = pickle.load(f)
|
11 |
+
|
12 |
+
with open("Model/logistic_regression_model.pkl", "rb") as f:
|
13 |
+
logistic_regression_model = pickle.load(f)
|
14 |
+
|
15 |
+
|
16 |
+
# Streamlit app header
|
17 |
+
st.header("Fake News Prediction")
|
18 |
+
st.subheader("Created by Snehangshu Bhuin")
|
19 |
+
|
20 |
+
# Input fields for user
|
21 |
+
title = st.text_input("News Title")
|
22 |
+
text = st.text_area("Description")
|
23 |
+
|
24 |
+
# Prediction button
|
25 |
+
if st.button("Predict"):
|
26 |
+
# Transform the input text
|
27 |
+
title_transformed = vectorizer_title.transform([title])
|
28 |
+
text_transformed = vectorizer_text.transform([text])
|
29 |
+
|
30 |
+
|
31 |
+
input_features = np.hstack((title_transformed.toarray(), text_transformed.toarray()))
|
32 |
+
|
33 |
+
# Make prediction
|
34 |
+
prediction = logistic_regression_model.predict(input_features)
|
35 |
+
print(prediction)
|
36 |
+
# Display the prediction result
|
37 |
+
if prediction == 1:
|
38 |
+
st.success("The news is likely Real")
|
39 |
+
else:
|
40 |
+
st.error("The news is likely Fake")
|
logistic_regression_model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6c0c9cf6183cb3d9f18f592ceacfc02b0df28f264f988585cec3f67a9cc96c82
|
3 |
+
size 40706
|
requirements.txt
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
absl-py==2.1.0
|
2 |
+
altair==5.2.0
|
3 |
+
anyio==4.3.0
|
4 |
+
argon2-cffi==23.1.0
|
5 |
+
argon2-cffi-bindings==21.2.0
|
6 |
+
arrow==1.3.0
|
7 |
+
asttokens==2.4.1
|
8 |
+
astunparse==1.6.3
|
9 |
+
async-lru==2.0.4
|
10 |
+
attrs==23.2.0
|
11 |
+
Babel==2.14.0
|
12 |
+
beautifulsoup4==4.12.3
|
13 |
+
bleach==6.1.0
|
14 |
+
blinker==1.7.0
|
15 |
+
cachetools==5.3.2
|
16 |
+
certifi==2024.2.2
|
17 |
+
cffi==1.16.0
|
18 |
+
charset-normalizer==3.3.2
|
19 |
+
click==8.1.7
|
20 |
+
colorama==0.4.6
|
21 |
+
comm==0.2.1
|
22 |
+
contourpy==1.2.0
|
23 |
+
cycler==0.12.1
|
24 |
+
debugpy==1.8.1
|
25 |
+
decorator==5.1.1
|
26 |
+
defusedxml==0.7.1
|
27 |
+
distlib==0.3.8
|
28 |
+
executing==2.0.1
|
29 |
+
fastjsonschema==2.19.1
|
30 |
+
filelock==3.15.1
|
31 |
+
flatbuffers==23.5.26
|
32 |
+
fonttools==4.49.0
|
33 |
+
fqdn==1.5.1
|
34 |
+
gast==0.5.4
|
35 |
+
gitdb==4.0.11
|
36 |
+
GitPython==3.1.42
|
37 |
+
google-auth==2.28.0
|
38 |
+
google-auth-oauthlib==1.2.0
|
39 |
+
google-pasta==0.2.0
|
40 |
+
grpcio==1.60.1
|
41 |
+
h11==0.14.0
|
42 |
+
h5py==3.10.0
|
43 |
+
httpcore==1.0.4
|
44 |
+
httpx==0.27.0
|
45 |
+
idna==3.6
|
46 |
+
importlib-metadata==7.0.1
|
47 |
+
ipykernel==6.29.2
|
48 |
+
ipython==8.21.0
|
49 |
+
ipywidgets==8.1.2
|
50 |
+
isoduration==20.11.0
|
51 |
+
jedi==0.19.1
|
52 |
+
Jinja2==3.1.3
|
53 |
+
joblib==1.3.2
|
54 |
+
json5==0.9.17
|
55 |
+
jsonpointer==2.4
|
56 |
+
jsonschema==4.21.1
|
57 |
+
jsonschema-specifications==2023.12.1
|
58 |
+
jupyter==1.0.0
|
59 |
+
jupyter-console==6.6.3
|
60 |
+
jupyter-events==0.9.0
|
61 |
+
jupyter-lsp==2.2.2
|
62 |
+
jupyter_client==8.6.0
|
63 |
+
jupyter_core==5.7.1
|
64 |
+
jupyter_server==2.12.5
|
65 |
+
jupyter_server_terminals==0.5.2
|
66 |
+
jupyterlab==4.1.2
|
67 |
+
jupyterlab_pygments==0.3.0
|
68 |
+
jupyterlab_server==2.25.3
|
69 |
+
jupyterlab_widgets==3.0.10
|
70 |
+
keras==2.15.0
|
71 |
+
kiwisolver==1.4.5
|
72 |
+
lab==8.0
|
73 |
+
libclang==16.0.6
|
74 |
+
Markdown==3.5.2
|
75 |
+
markdown-it-py==3.0.0
|
76 |
+
MarkupSafe==2.1.5
|
77 |
+
matplotlib==3.8.3
|
78 |
+
matplotlib-inline==0.1.6
|
79 |
+
mdurl==0.1.2
|
80 |
+
mistune==3.0.2
|
81 |
+
ml-dtypes==0.2.0
|
82 |
+
namex==0.0.8
|
83 |
+
nbclient==0.9.0
|
84 |
+
nbconvert==7.16.1
|
85 |
+
nbformat==5.9.2
|
86 |
+
nest-asyncio==1.6.0
|
87 |
+
nltk==3.8.1
|
88 |
+
notebook==7.1.0
|
89 |
+
notebook_shim==0.2.4
|
90 |
+
numpy==1.26.4
|
91 |
+
oauthlib==3.2.2
|
92 |
+
opt-einsum==3.3.0
|
93 |
+
optree==0.11.0
|
94 |
+
overrides==7.7.0
|
95 |
+
packaging==23.2
|
96 |
+
pandas==2.2.0
|
97 |
+
pandocfilters==1.5.1
|
98 |
+
parso==0.8.3
|
99 |
+
pillow==10.2.0
|
100 |
+
platformdirs==4.2.0
|
101 |
+
prometheus_client==0.20.0
|
102 |
+
prompt-toolkit==3.0.43
|
103 |
+
protobuf==4.25.3
|
104 |
+
psutil==5.9.8
|
105 |
+
pure-eval==0.2.2
|
106 |
+
pyarrow==15.0.0
|
107 |
+
pyasn1==0.5.1
|
108 |
+
pyasn1-modules==0.3.0
|
109 |
+
pycparser==2.21
|
110 |
+
pydeck==0.8.1b0
|
111 |
+
Pygments==2.17.2
|
112 |
+
pyparsing==3.1.1
|
113 |
+
python-dateutil==2.8.2
|
114 |
+
python-json-logger==2.0.7
|
115 |
+
pytz==2024.1
|
116 |
+
pywin32==306
|
117 |
+
pywinpty==2.0.12
|
118 |
+
PyYAML==6.0.1
|
119 |
+
pyzmq==25.1.2
|
120 |
+
qtconsole==5.5.1
|
121 |
+
QtPy==2.4.1
|
122 |
+
referencing==0.33.0
|
123 |
+
regex==2023.12.25
|
124 |
+
requests==2.31.0
|
125 |
+
requests-oauthlib==1.3.1
|
126 |
+
rfc3339-validator==0.1.4
|
127 |
+
rfc3986-validator==0.1.1
|
128 |
+
rich==13.7.0
|
129 |
+
rpds-py==0.18.0
|
130 |
+
rsa==4.9
|
131 |
+
scikit-learn==1.4.1.post1
|
132 |
+
scipy==1.12.0
|
133 |
+
seaborn==0.13.2
|
134 |
+
Send2Trash==1.8.2
|
135 |
+
simplejson==3.19.2
|
136 |
+
six==1.16.0
|
137 |
+
smmap==5.0.1
|
138 |
+
sniffio==1.3.0
|
139 |
+
soupsieve==2.5
|
140 |
+
stack-data==0.6.3
|
141 |
+
streamlit==1.31.1
|
142 |
+
tenacity==8.2.3
|
143 |
+
tensorboard==2.15.2
|
144 |
+
tensorboard-data-server==0.7.2
|
145 |
+
tensorflow==2.15.0
|
146 |
+
tensorflow-estimator==2.15.0
|
147 |
+
tensorflow-intel==2.15.0
|
148 |
+
tensorflow-io-gcs-filesystem==0.31.0
|
149 |
+
termcolor==2.4.0
|
150 |
+
terminado==0.18.0
|
151 |
+
threadpoolctl==3.3.0
|
152 |
+
tinycss2==1.2.1
|
153 |
+
toml==0.10.2
|
154 |
+
toolz==0.12.1
|
155 |
+
tornado==6.4
|
156 |
+
tqdm==4.66.2
|
157 |
+
traitlets==5.14.1
|
158 |
+
txt2tags==3.9
|
159 |
+
types-python-dateutil==2.8.19.20240106
|
160 |
+
typing_extensions==4.9.0
|
161 |
+
tzdata==2024.1
|
162 |
+
tzlocal==5.2
|
163 |
+
uri-template==1.3.0
|
164 |
+
urllib3==2.2.1
|
165 |
+
validators==0.22.0
|
166 |
+
virtualenv==20.26.2
|
167 |
+
watchdog==4.0.0
|
168 |
+
wcwidth==0.2.13
|
169 |
+
webcolors==1.13
|
170 |
+
webencodings==0.5.1
|
171 |
+
websocket-client==1.7.0
|
172 |
+
Werkzeug==3.0.1
|
173 |
+
widgetsnbextension==4.0.10
|
174 |
+
wrapt==1.14.1
|
175 |
+
xgboost==2.0.3
|
176 |
+
zipp==3.17.0
|
vectorizer_text.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:13038e1cbf88a684ad47b3cebae278bcf1b2fcbae47db9f6f6a4e2b55fc158cb
|
3 |
+
size 63941465
|
vectorizer_title.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:56c39a7a99e61bca6feda62d4efeee491ad019110253f7c316d33ab05dcd5b23
|
3 |
+
size 3138441
|