Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -74,19 +74,19 @@ def analyze_video(video_file):
|
|
74 |
try:
|
75 |
truncated_video = truncate_video(video_file)
|
76 |
results = analyzer.analyze_media(truncated_video)
|
77 |
-
|
78 |
-
# Ensure 'combined_assessment' is numeric
|
79 |
-
combined_assessment = results.get('combined_assessment', 0)
|
80 |
-
if isinstance(combined_assessment, str) and not combined_assessment.isdigit():
|
81 |
-
raise ValueError(f"Non-numeric combined_assessment value: {combined_assessment}")
|
82 |
|
83 |
-
combined_assessment
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
output = {
|
86 |
"message": f"According to our analysis, the video you uploaded appears to be {analysis_result}. "
|
87 |
f"{len(results['video_analysis']['frame_results'])} frames were analyzed in total."
|
88 |
}
|
89 |
-
|
90 |
return output
|
91 |
|
92 |
except Exception as e:
|
|
|
74 |
try:
|
75 |
truncated_video = truncate_video(video_file)
|
76 |
results = analyzer.analyze_media(truncated_video)
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
+
# Get combined_assessment and handle non-numeric values
|
79 |
+
combined_assessment = results.get('combined_assessment', 0)
|
80 |
+
if isinstance(combined_assessment, str) and combined_assessment.lower() == "deepfake":
|
81 |
+
analysis_result = "a deepfake"
|
82 |
+
else:
|
83 |
+
combined_assessment = int(combined_assessment) if str(combined_assessment).isdigit() else 0
|
84 |
+
analysis_result = "genuine/original" if combined_assessment < 50 else "a deepfake"
|
85 |
+
|
86 |
output = {
|
87 |
"message": f"According to our analysis, the video you uploaded appears to be {analysis_result}. "
|
88 |
f"{len(results['video_analysis']['frame_results'])} frames were analyzed in total."
|
89 |
}
|
|
|
90 |
return output
|
91 |
|
92 |
except Exception as e:
|