asad231 commited on
Commit
1b584d1
Β·
verified Β·
1 Parent(s): b315274

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -19
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 your news here...")
143
 
144
  if st.button("Check News"):
145
- if not news_input.strip():
146
- st.warning("⚠️ Please enter some news text to analyze.")
 
 
 
 
 
 
147
  else:
148
- st.write("πŸ” Processing...")
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"])