Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -74,7 +74,13 @@ def analyze_video(video_file):
|
|
| 74 |
try:
|
| 75 |
truncated_video = truncate_video(video_file)
|
| 76 |
results = analyzer.analyze_media(truncated_video)
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
analysis_result = "genuine/original" if combined_assessment < 50 else "a deepfake"
|
| 79 |
output = {
|
| 80 |
"message": f"According to our analysis, the video you uploaded appears to be {analysis_result}. "
|
|
@@ -87,6 +93,7 @@ def analyze_video(video_file):
|
|
| 87 |
logging.error(f"Error during analysis: {e}")
|
| 88 |
return {"error": "An error occurred during video analysis. Please check your input and try again."}
|
| 89 |
|
|
|
|
| 90 |
interface = gr.Interface(
|
| 91 |
fn=analyze_video,
|
| 92 |
inputs=gr.Video(label="Upload Video"),
|
|
|
|
| 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 = int(combined_assessment)
|
| 84 |
analysis_result = "genuine/original" if combined_assessment < 50 else "a deepfake"
|
| 85 |
output = {
|
| 86 |
"message": f"According to our analysis, the video you uploaded appears to be {analysis_result}. "
|
|
|
|
| 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 |
|
| 96 |
+
|
| 97 |
interface = gr.Interface(
|
| 98 |
fn=analyze_video,
|
| 99 |
inputs=gr.Video(label="Upload Video"),
|