File size: 1,004 Bytes
6cb026f
 
775c87e
6cb026f
 
8b12c3e
775c87e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import streamlit as st
from transformers import pipeline
st.cache_resource(ttl=300)

pipe = pipeline(task="text-classification",model="yartyjung/Fake-Review-Detector")
st.title(":green[Real ] :rainbow[or] :red[Fake]")
st.divider()
text = st.text_input("Your :red[suspicious] review here :sunglasses:",value="")
if st.button("predict"):
    if text is not None:
        predictions = pipe(text)
        if predictions[0]['label'] == 'fake':
            for p in predictions:
                st.subheader(f":red[FAKE]   :blue[{ round(p['score'] * 100, 1)} %]")
        elif predictions[0]['label'] == 'real':
            for p in predictions:
                st.subheader(f":green[REAL]   :blue[{ round(p['score'] * 100, 1)} %]")
        st.divider()
        st.markdown(":red[***disclaimer***   This is a prediction by an _AI_, which might turn out incorrect.]")
        url = "https://huggingface.co/yartyjung/Fake-Review-Detector"
        st.markdown(":yellow[check out model at this [link](%s)]" % url)