asad231 commited on
Commit
9eb2d43
·
verified ·
1 Parent(s): af8752c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -11
app.py CHANGED
@@ -438,16 +438,19 @@ elif video_url:
438
  st.video(video_url) # Show the video directly from URL
439
  video_path = download_video(video_url) # Download the video for analysis
440
 
441
- # Analyze Button
442
- if video_path and st.button("Analyze Video"):
443
- st.write("🔍 Processing... Please wait.")
444
- result = detect_deepfake_video(video_path)
445
-
446
- if result["label"] == "FAKE":
447
- st.error(f"⚠️ Deepfake Detected! This video appears to be FAKE. (Confidence: {result['score']:.2f})")
448
- elif result["label"] == "REAL":
449
- st.success(f" This video appears to be REAL. (Confidence: {1 - result['score']:.2f})")
450
- else:
451
- st.warning("⚠️ Unable to analyze the video. Please try a different file.")
 
 
 
452
 
453
  st.markdown("🔹 **Developed for Fake News & Deepfake Detection Hackathon**")
 
438
  st.video(video_url) # Show the video directly from URL
439
  video_path = download_video(video_url) # Download the video for analysis
440
 
441
+ # Ensure video_path is valid before analysis
442
+ if video_path and os.path.exists(video_path):
443
+ if st.button("Analyze Video"):
444
+ st.write("🔍 Processing... Please wait.")
445
+ result = detect_deepfake_video(video_path)
446
+
447
+ if result["label"] == "FAKE":
448
+ st.error(f"⚠️ Deepfake Detected! This video appears to be FAKE. (Confidence: {result['score']:.2f})")
449
+ elif result["label"] == "REAL":
450
+ st.success(f"✅ This video appears to be REAL. (Confidence: {1 - result['score']:.2f})")
451
+ else:
452
+ st.warning("⚠️ Unable to analyze the video. Please try a different file.")
453
+ else:
454
+ st.warning("⚠️ Please upload a video or enter a valid URL.")
455
 
456
  st.markdown("🔹 **Developed for Fake News & Deepfake Detection Hackathon**")