ikoghoemmanuell
commited on
Commit
·
b395baf
1
Parent(s):
e618b6c
Delete predict_function.py
Browse files- predict_function.py +0 -15
predict_function.py
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
import transformers
|
3 |
-
|
4 |
-
# Define the function for detecting fake news
|
5 |
-
@st.cache_resource
|
6 |
-
def detect_fake_news(text):
|
7 |
-
# Load the pipeline.
|
8 |
-
pipeline = transformers.pipeline("text-classification", model=model_name, tokenizer=tokenizer_name)
|
9 |
-
|
10 |
-
# Predict the sentiment.
|
11 |
-
prediction = pipeline(text)
|
12 |
-
sentiment = prediction[0]["label"]
|
13 |
-
score = prediction[0]["score"]
|
14 |
-
|
15 |
-
return sentiment, score
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|