Update app.py
Browse files
app.py
CHANGED
@@ -179,16 +179,19 @@ news_input = st.text_area("Enter News Text:", placeholder="Type here...")
|
|
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
|
|
|
|
|
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"])
|
|
|
179 |
if st.button("Check News"):
|
180 |
st.write("🔍 Processing...")
|
181 |
|
182 |
+
# Use AI model to classify the news
|
183 |
prediction = fake_news_detector(news_input)
|
184 |
label = prediction[0]['label'].lower()
|
185 |
confidence = prediction[0]['score']
|
186 |
|
187 |
+
# Fix classification issue
|
188 |
+
if confidence < 0.5:
|
189 |
+
st.warning(f"⚠️ Unable to classify with high confidence. Please verify manually. (Confidence: {confidence:.2f})")
|
190 |
+
elif label in ["fake", "false", "negative"]:
|
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"])
|