asad231 commited on
Commit
3e75399
·
verified ·
1 Parent(s): 285eba1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -184,14 +184,11 @@ if st.button("Check News"):
184
  label = prediction[0]['label'].lower()
185
  confidence = prediction[0]['score']
186
 
187
- # Correct classification logic
188
- if label == "fake" or confidence > 0.6: # Adjusted confidence threshold
189
  st.error(f"⚠️ Result: This news is **FAKE**. (Confidence: {confidence:.2f})")
190
- elif label == "real" and confidence > 0.6:
191
- st.success(f"✅ Result: This news is **REAL**. (Confidence: {confidence:.2f})")
192
  else:
193
- st.warning(f"⚠️ Unable to classify with high confidence. Please verify manually. (Confidence: {confidence:.2f})")
194
-
195
  # ---- Deepfake Image Detection Section ----
196
  st.subheader("📸 Deepfake Image Detection")
197
  uploaded_image = st.file_uploader("Upload an Image", type=["jpg", "png", "jpeg"])
 
184
  label = prediction[0]['label'].lower()
185
  confidence = prediction[0]['score']
186
 
187
+ # Ensure classification even for low confidence cases
188
+ if label == "fake" or confidence >= 0.5:
189
  st.error(f"⚠️ Result: This news is **FAKE**. (Confidence: {confidence:.2f})")
 
 
190
  else:
191
+ st.success(f" Result: This news is **REAL**. (Confidence: {confidence:.2f})")
 
192
  # ---- Deepfake Image Detection Section ----
193
  st.subheader("📸 Deepfake Image Detection")
194
  uploaded_image = st.file_uploader("Upload an Image", type=["jpg", "png", "jpeg"])