asad231 commited on
Commit
b386768
ยท
verified ยท
1 Parent(s): de87c87

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -173,8 +173,6 @@ def detect_deepfake_image(image_path):
173
  # else:
174
  # st.success(f"โœ… Result: This news is **REAL**. (Confidence: {confidence:.2f})")
175
  # ---- Fake News Detection Section ----
176
- import streamlit as st
177
-
178
  st.subheader("๐Ÿ“ Fake News Detection")
179
  news_input = st.text_area("Enter News Text:", placeholder="Type here...")
180
 
@@ -186,12 +184,13 @@ if st.button("Check News"):
186
  label = prediction[0]['label'].lower()
187
  confidence = prediction[0]['score']
188
 
189
- # Ensure proper classification
190
- if label in ["fake", "false", "negative"] or confidence < 0.7:
 
 
191
  st.error(f"โš ๏ธ Result: This news is **FAKE**. (Confidence: {confidence:.2f})")
192
  else:
193
- st.success(f"โœ… Result: This news is **REAL**. (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"])
 
173
  # else:
174
  # st.success(f"โœ… Result: This news is **REAL**. (Confidence: {confidence:.2f})")
175
  # ---- Fake News Detection Section ----
 
 
176
  st.subheader("๐Ÿ“ Fake News Detection")
177
  news_input = st.text_area("Enter News Text:", placeholder="Type here...")
178
 
 
184
  label = prediction[0]['label'].lower()
185
  confidence = prediction[0]['score']
186
 
187
+ # Ensure correct classification
188
+ if confidence > 0.75 and label in ["real", "true", "positive"]:
189
+ st.success(f"โœ… Result: This news is **REAL**. (Confidence: {confidence:.2f})")
190
+ elif confidence < 0.5 or label in ["fake", "false", "negative"]:
191
  st.error(f"โš ๏ธ Result: This news is **FAKE**. (Confidence: {confidence:.2f})")
192
  else:
193
+ st.warning(f"โš ๏ธ Unable to classify with high confidence. Please verify manually. (Confidence: {confidence:.2f})")
 
194
  # ---- Deepfake Image Detection Section ----
195
  st.subheader("๐Ÿ“ธ Deepfake Image Detection")
196
  uploaded_image = st.file_uploader("Upload an Image", type=["jpg", "png", "jpeg"])