NeeravS commited on
Commit
b2619fa
·
verified ·
1 Parent(s): a222225

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -75,15 +75,11 @@ def analyze_video(video_file):
75
  truncated_video = truncate_video(video_file)
76
  results = analyzer.analyze_media(truncated_video)
77
  combined_assessment = results.get('combined_assessment', 0)
78
- if isinstance(combined_assessment, (int, float)):
79
- combined_probability = combined_assessment
80
- else:
81
- combined_probability = 100 if combined_assessment == "Deepfake" else 0
82
-
83
- analysis_result = "genuine/original" if combined_probability < 50 else "a deepfake"
84
  output = {
85
- "message": f"According to our analysis, the video you uploaded appears to be {analysis_result} "
86
- f"with a {combined_probability:.2f}% probability. "
87
  f"{len(results['video_analysis']['frame_results'])} frames were analyzed in total."
88
  }
89
 
@@ -92,6 +88,7 @@ def analyze_video(video_file):
92
  except Exception as e:
93
  logging.error(f"Error during analysis: {e}")
94
  return {"error": "An error occurred during video analysis. Please check your input and try again."}
 
95
  interface = gr.Interface(
96
  fn=analyze_video,
97
  inputs=gr.Video(label="Upload Video"),
 
75
  truncated_video = truncate_video(video_file)
76
  results = analyzer.analyze_media(truncated_video)
77
  combined_assessment = results.get('combined_assessment', 0)
78
+
79
+ analysis_result = "genuine/original" if combined_assessment < 50 else "a deepfake"
80
+
 
 
 
81
  output = {
82
+ "message": f"According to our analysis, the video you uploaded appears to be {analysis_result}. "
 
83
  f"{len(results['video_analysis']['frame_results'])} frames were analyzed in total."
84
  }
85
 
 
88
  except Exception as e:
89
  logging.error(f"Error during analysis: {e}")
90
  return {"error": "An error occurred during video analysis. Please check your input and try again."}
91
+
92
  interface = gr.Interface(
93
  fn=analyze_video,
94
  inputs=gr.Video(label="Upload Video"),