Update app.py
Browse files
app.py
CHANGED
@@ -139,28 +139,19 @@ def detect_deepfake_image(image_path):
|
|
139 |
|
140 |
# ---- Fake News Detection Section ----
|
141 |
st.subheader("π Fake News Detection")
|
142 |
-
news_input = st.text_area("Enter News Text:", placeholder="Type
|
143 |
|
144 |
if st.button("Check News"):
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
else:
|
148 |
-
st.
|
149 |
-
|
150 |
-
# Detect Fake News
|
151 |
-
prediction = fake_news_detector(news_input)
|
152 |
-
label = prediction[0]['label']
|
153 |
-
confidence = round(prediction[0]['score'], 2)
|
154 |
-
|
155 |
-
# Improved Classification
|
156 |
-
if label.lower() in ["fake", "negative"]:
|
157 |
-
st.error(f"β οΈ Fake News Detected! This news appears to be FAKE. (Confidence: {confidence:.2f})")
|
158 |
-
st.write("β **Warning:** This content might be misleading or false.")
|
159 |
-
elif label.lower() in ["real", "positive"]:
|
160 |
-
st.success(f"β
This news appears to be REAL. (Confidence: {confidence:.2f})")
|
161 |
-
st.write("βοΈ **Verified:** This content seems legitimate.")
|
162 |
-
else:
|
163 |
-
st.warning("β οΈ Unable to classify the news confidently. Please check the content manually.")
|
164 |
# ---- Deepfake Image Detection Section ----
|
165 |
st.subheader("πΈ Deepfake Image Detection")
|
166 |
uploaded_image = st.file_uploader("Upload an Image", type=["jpg", "png", "jpeg"])
|
|
|
139 |
|
140 |
# ---- Fake News Detection Section ----
|
141 |
st.subheader("π Fake News Detection")
|
142 |
+
news_input = st.text_area("Enter News Text:", placeholder="Type here...")
|
143 |
|
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 |
+
# Ensure classification is always either REAL or FAKE
|
151 |
+
if label.lower() in ["fake", "false", "negative"]:
|
152 |
+
st.error(f"β οΈ Result: This news is FAKE. (Confidence: {confidence:.2f})")
|
153 |
else:
|
154 |
+
st.success(f"β
Result: This news is REAL. (Confidence: {confidence:.2f})")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
# ---- Deepfake Image Detection Section ----
|
156 |
st.subheader("πΈ Deepfake Image Detection")
|
157 |
uploaded_image = st.file_uploader("Upload an Image", type=["jpg", "png", "jpeg"])
|