ikoghoemmanuell commited on
Commit
891311d
·
1 Parent(s): a9711de

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -11,7 +11,7 @@ tokenizer = AutoTokenizer.from_pretrained("ikoghoemmanuell/finetuned_fake_news_b
11
  @st.cache_resource
12
  def detect_fake_news(text):
13
  # Load the pipeline.
14
- pipeline = transformers.pipeline("text-classification")
15
 
16
  # Predict the sentiment.
17
  prediction = pipeline(text)
@@ -59,7 +59,7 @@ unsafe_allow_html=True
59
  if text:
60
  label, score = detect_fake_news(text)
61
  print(label, score)
62
- if label == "NEGATIVE":
63
  st.error(f"The text is likely to be fake news with a confidence score of {score*100:.2f}%!")
64
  else:
65
  st.success(f"The text is likely to be genuine with a confidence score of {score*100:.2f}%!")
 
11
  @st.cache_resource
12
  def detect_fake_news(text):
13
  # Load the pipeline.
14
+ model = transformers.pipeline("text-classification", model=model, tokenizer=tokenizer)
15
 
16
  # Predict the sentiment.
17
  prediction = pipeline(text)
 
59
  if text:
60
  label, score = detect_fake_news(text)
61
  print(label, score)
62
+ if label == "LABEL_1":
63
  st.error(f"The text is likely to be fake news with a confidence score of {score*100:.2f}%!")
64
  else:
65
  st.success(f"The text is likely to be genuine with a confidence score of {score*100:.2f}%!")