asad231 commited on
Commit
aeaf5bf
·
verified ·
1 Parent(s): 1dcc499

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -271,12 +271,14 @@ news_input = st.text_area("Enter News Text:", placeholder="Type here...")
271
 
272
  if st.button("Check News"):
273
  st.write("\U0001F50D Processing...")
274
- labels = ["fake news", "real news"]
275
- prediction = fake_news_detector(news_input, labels)
276
- label = prediction['labels'][0]
277
- confidence = prediction['scores'][0]
278
-
279
- if label == "fake news":
 
 
280
  st.error(f"⚠️ Result: This news is FAKE. (Confidence: {confidence:.2f})")
281
  else:
282
  st.success(f"✅ Result: This news is REAL. (Confidence: {confidence:.2f})")
 
271
 
272
  if st.button("Check News"):
273
  st.write("\U0001F50D Processing...")
274
+
275
+ labels = ["FAKE", "REAL"] # Corrected labels
276
+ prediction = fake_news_detector(news_input, candidate_labels=labels)
277
+
278
+ label = prediction["labels"][0] # Highest confidence label
279
+ confidence = prediction["scores"][0] # Confidence of highest label
280
+
281
+ if label == "FAKE":
282
  st.error(f"⚠️ Result: This news is FAKE. (Confidence: {confidence:.2f})")
283
  else:
284
  st.success(f"✅ Result: This news is REAL. (Confidence: {confidence:.2f})")