Update app.py
Browse files
app.py
CHANGED
|
@@ -173,22 +173,27 @@ 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 |
st.subheader("π Fake News Detection")
|
| 177 |
news_input = st.text_area("Enter News Text:", placeholder="Type here...")
|
| 178 |
|
| 179 |
if st.button("Check News"):
|
| 180 |
st.write("π Processing...")
|
| 181 |
|
| 182 |
-
#
|
| 183 |
prediction = fake_news_detector(news_input)
|
| 184 |
label = prediction[0]['label'].lower()
|
| 185 |
confidence = prediction[0]['score']
|
| 186 |
|
| 187 |
-
#
|
| 188 |
-
if label
|
| 189 |
st.error(f"β οΈ Result: This news is **FAKE**. (Confidence: {confidence:.2f})")
|
| 190 |
-
|
| 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"])
|
|
|
|
| 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 |
|
| 181 |
if st.button("Check News"):
|
| 182 |
st.write("π Processing...")
|
| 183 |
|
| 184 |
+
# Get AI model prediction
|
| 185 |
prediction = fake_news_detector(news_input)
|
| 186 |
label = prediction[0]['label'].lower()
|
| 187 |
confidence = prediction[0]['score']
|
| 188 |
|
| 189 |
+
# Correct classification logic
|
| 190 |
+
if label == "fake" or confidence > 0.6: # Adjusted confidence threshold
|
| 191 |
st.error(f"β οΈ Result: This news is **FAKE**. (Confidence: {confidence:.2f})")
|
| 192 |
+
elif label == "real" and confidence > 0.6:
|
| 193 |
st.success(f"β
Result: This news is **REAL**. (Confidence: {confidence:.2f})")
|
| 194 |
+
else:
|
| 195 |
+
st.warning(f"β οΈ Unable to classify with high confidence. Please verify manually. (Confidence: {confidence:.2f})")
|
| 196 |
+
|
| 197 |
# ---- Deepfake Image Detection Section ----
|
| 198 |
st.subheader("πΈ Deepfake Image Detection")
|
| 199 |
uploaded_image = st.file_uploader("Upload an Image", type=["jpg", "png", "jpeg"])
|