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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -9
app.py CHANGED
@@ -139,18 +139,28 @@ 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 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
- if label == "FAKE":
151
- st.error(f"⚠️ Result: This news is FAKE. (Confidence: {confidence:.2f})")
152
  else:
153
- st.success(f"βœ… Result: This news is REAL. (Confidence: {confidence:.2f})")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  # ---- Deepfake Image Detection Section ----
155
  st.subheader("πŸ“Έ Deepfake Image Detection")
156
  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 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"])