Update app.py
Browse files
app.py
CHANGED
@@ -144,14 +144,16 @@ news_input = st.text_area("Enter News Text:", placeholder="Type here...")
|
|
144 |
if st.button("Check News"):
|
145 |
st.write("🔍 Processing...")
|
146 |
prediction = fake_news_detector(news_input)
|
147 |
-
label = prediction[0]['label']
|
148 |
confidence = prediction[0]['score']
|
149 |
|
150 |
-
#
|
151 |
-
if
|
152 |
-
st.error(f"⚠️ Result: This news is FAKE
|
|
|
|
|
153 |
else:
|
154 |
-
st.
|
155 |
# ---- Deepfake Image Detection Section ----
|
156 |
st.subheader("📸 Deepfake Image Detection")
|
157 |
uploaded_image = st.file_uploader("Upload an Image", type=["jpg", "png", "jpeg"])
|
|
|
144 |
if st.button("Check News"):
|
145 |
st.write("🔍 Processing...")
|
146 |
prediction = fake_news_detector(news_input)
|
147 |
+
label = prediction[0]['label'].lower() # Convert label to lowercase for consistency
|
148 |
confidence = prediction[0]['score']
|
149 |
|
150 |
+
# Strict classification: FAKE news is always FAKE, and REAL news is always REAL
|
151 |
+
if "fake" in label or "false" in label or "negative" in label:
|
152 |
+
st.error(f"⚠️ Result: This news is **FAKE**. (Confidence: {confidence:.2f})")
|
153 |
+
elif "real" in label or "true" in label or "positive" in label:
|
154 |
+
st.success(f"✅ Result: This news is **REAL**. (Confidence: {confidence:.2f})")
|
155 |
else:
|
156 |
+
st.warning("⚠️ Unable to classify the news with high confidence. Please verify manually.")
|
157 |
# ---- Deepfake Image Detection Section ----
|
158 |
st.subheader("📸 Deepfake Image Detection")
|
159 |
uploaded_image = st.file_uploader("Upload an Image", type=["jpg", "png", "jpeg"])
|