Upload 4 files
Browse files- app.py +17 -14
- requirements.txt +1 -1
app.py
CHANGED
@@ -1,18 +1,21 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
|
|
3 |
|
4 |
pipe = pipeline(task="text-classification",model="yartyjung/Fake-Review-Detector")
|
5 |
-
|
6 |
-
st.
|
7 |
-
text = st.text_input("
|
8 |
-
|
9 |
-
if text is not None:
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
+
st.cache_resource(ttl=300)
|
4 |
|
5 |
pipe = pipeline(task="text-classification",model="yartyjung/Fake-Review-Detector")
|
6 |
+
st.title(":rainbow[Review-Detector]")
|
7 |
+
st.divider()
|
8 |
+
text = st.text_input("Your :red[suspicious] review here :sunglasses:",value="")
|
9 |
+
if st.button("predict"):
|
10 |
+
if text is not None:
|
11 |
+
predictions = pipe(text)
|
12 |
+
if predictions[0]['label'] == 'fake':
|
13 |
+
for p in predictions:
|
14 |
+
st.subheader(f":red[FAKE] :blue[{ round(p['score'] * 100, 1)} %]")
|
15 |
+
elif predictions[0]['label'] == 'real':
|
16 |
+
for p in predictions:
|
17 |
+
st.subheader(f":green[REAL] :blue[{ round(p['score'] * 100, 1)} %]")
|
18 |
+
st.divider()
|
19 |
+
st.markdown(":red[***disclaimer*** This is a prediction by an _AI_, which might turn out incorrect.]")
|
20 |
+
url = "https://huggingface.co/yartyjung/Fake-Review-Detector"
|
21 |
+
st.markdown(":yellow[check out model at this [link](%s)]" % url)
|
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
transformers
|
2 |
torch
|
|
|
1 |
+
transformers
|
2 |
torch
|