Update app.py
Browse files
app.py
CHANGED
@@ -11,15 +11,14 @@ from Scraper import Scrap
|
|
11 |
st.set_page_config(layout="wide")
|
12 |
|
13 |
model_checkpoint = "Rifky/FND"
|
14 |
-
data_checkpoint =
|
15 |
label = {0: "valid", 1: "fake"}
|
16 |
|
17 |
@st.cache(show_spinner=False, allow_output_mutation=True)
|
18 |
def load_model():
|
19 |
model = AutoModelForSequenceClassification.from_pretrained(model_checkpoint, num_labels=2)
|
20 |
-
base_model = AutoModel.from_pretrained(model_checkpoint)
|
21 |
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint, fast=True)
|
22 |
-
return model,
|
23 |
|
24 |
def sigmoid(x):
|
25 |
return 1 / (1 + np.exp(-x))
|
@@ -28,7 +27,7 @@ input_column, reference_column = st.columns(2)
|
|
28 |
input_column.write('# Fake News Detection AI')
|
29 |
|
30 |
with st.spinner("Loading Model..."):
|
31 |
-
model,
|
32 |
data = pd.read_csv(data_checkpoint)
|
33 |
|
34 |
user_input = input_column.text_input("Article url")
|
|
|
11 |
st.set_page_config(layout="wide")
|
12 |
|
13 |
model_checkpoint = "Rifky/FND"
|
14 |
+
data_checkpoint = "Rifky/turnbackhoax-encoded"
|
15 |
label = {0: "valid", 1: "fake"}
|
16 |
|
17 |
@st.cache(show_spinner=False, allow_output_mutation=True)
|
18 |
def load_model():
|
19 |
model = AutoModelForSequenceClassification.from_pretrained(model_checkpoint, num_labels=2)
|
|
|
20 |
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint, fast=True)
|
21 |
+
return model, tokenizer
|
22 |
|
23 |
def sigmoid(x):
|
24 |
return 1 / (1 + np.exp(-x))
|
|
|
27 |
input_column.write('# Fake News Detection AI')
|
28 |
|
29 |
with st.spinner("Loading Model..."):
|
30 |
+
model, tokenizer = load_model()
|
31 |
data = pd.read_csv(data_checkpoint)
|
32 |
|
33 |
user_input = input_column.text_input("Article url")
|