Spaces:
Runtime error
Runtime error
Update video_processing.py
Browse files- video_processing.py +15 -6
video_processing.py
CHANGED
|
@@ -199,13 +199,22 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
|
|
| 199 |
mse_heatmap_embeddings = plot_mse_heatmap(mse_embeddings, "Facial Features MSE Heatmap", df)
|
| 200 |
mse_heatmap_posture = plot_mse_heatmap(mse_posture, "Body Posture MSE Heatmap", df)
|
| 201 |
mse_heatmap_voice = plot_mse_heatmap(mse_voice, "Voice MSE Heatmap", df)
|
| 202 |
-
|
| 203 |
-
if progress:
|
| 204 |
-
progress(0.95, "Generating video with heatmap")
|
| 205 |
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
|
| 210 |
|
| 211 |
except Exception as e:
|
|
|
|
| 199 |
mse_heatmap_embeddings = plot_mse_heatmap(mse_embeddings, "Facial Features MSE Heatmap", df)
|
| 200 |
mse_heatmap_posture = plot_mse_heatmap(mse_posture, "Body Posture MSE Heatmap", df)
|
| 201 |
mse_heatmap_voice = plot_mse_heatmap(mse_voice, "Voice MSE Heatmap", df)
|
|
|
|
|
|
|
|
|
|
| 202 |
|
| 203 |
+
try:
|
| 204 |
+
if progress is not None:
|
| 205 |
+
progress(0.95, desc="Generating video with heatmap")
|
| 206 |
+
|
| 207 |
+
heatmap_video_path = create_video_with_heatmap(
|
| 208 |
+
video_path, df, mse_embeddings, mse_posture, mse_voice,
|
| 209 |
+
heatmap_video_path, original_fps, largest_cluster,
|
| 210 |
+
progress=progress
|
| 211 |
+
)
|
| 212 |
+
|
| 213 |
+
if progress is not None:
|
| 214 |
+
progress(1.0, desc="Video processing complete")
|
| 215 |
+
except Exception as e:
|
| 216 |
+
print(f"Error in create_video_with_heatmap: {str(e)}")
|
| 217 |
+
heatmap_video_path = None
|
| 218 |
|
| 219 |
|
| 220 |
except Exception as e:
|