Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,16 +54,9 @@ def process_and_show_completion(video_input_path, anomaly_threshold_input, fps,
|
|
| 54 |
return [error_message] + [None] * 27
|
| 55 |
|
| 56 |
def show_results(outputs):
|
| 57 |
-
return gr.
|
| 58 |
|
| 59 |
with gr.Blocks() as iface:
|
| 60 |
-
description = gr.Markdown("""
|
| 61 |
-
# Multimodal Behavioral Anomalies Detection
|
| 62 |
-
|
| 63 |
-
This tool detects anomalies in facial expressions, body language, and voice over the timeline of a video.
|
| 64 |
-
It extracts faces, postures, and voice from video frames, and analyzes them to identify anomalies using time series analysis and a variational autoencoder (VAE) approach.
|
| 65 |
-
""")
|
| 66 |
-
|
| 67 |
with gr.Row():
|
| 68 |
video_input = gr.Video(label="Input Video")
|
| 69 |
|
|
@@ -76,31 +69,38 @@ with gr.Blocks() as iface:
|
|
| 76 |
with execution_time_group:
|
| 77 |
execution_time = gr.Number(label="Execution Time (seconds)")
|
| 78 |
|
| 79 |
-
with gr.
|
| 80 |
-
with gr.
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
df_store = gr.State()
|
| 106 |
mse_features_store = gr.State()
|
|
@@ -130,7 +130,7 @@ with gr.Blocks() as iface:
|
|
| 130 |
).then(
|
| 131 |
show_results,
|
| 132 |
inputs=None,
|
| 133 |
-
outputs=[
|
| 134 |
)
|
| 135 |
|
| 136 |
if __name__ == "__main__":
|
|
|
|
| 54 |
return [error_message] + [None] * 27
|
| 55 |
|
| 56 |
def show_results(outputs):
|
| 57 |
+
return gr.Tabs(visible=True), gr.Group(visible=True)
|
| 58 |
|
| 59 |
with gr.Blocks() as iface:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
with gr.Row():
|
| 61 |
video_input = gr.Video(label="Input Video")
|
| 62 |
|
|
|
|
| 69 |
with execution_time_group:
|
| 70 |
execution_time = gr.Number(label="Execution Time (seconds)")
|
| 71 |
|
| 72 |
+
with gr.Tabs(visible=True) as results_tabs:
|
| 73 |
+
with gr.TabItem("Description"):
|
| 74 |
+
gr.Markdown("""
|
| 75 |
+
# Multimodal Behavioral Anomalies Detection
|
| 76 |
+
|
| 77 |
+
This tool detects anomalies in facial expressions, body language, and voice over the timeline of a video.
|
| 78 |
+
It extracts faces, postures, and voice from video frames, and analyzes them to identify anomalies using time series analysis and a variational autoencoder (VAE) approach.
|
| 79 |
+
""")
|
| 80 |
+
|
| 81 |
+
with gr.TabItem("Facial Features"):
|
| 82 |
+
results_text = gr.TextArea(label="Faces Breakdown", lines=5)
|
| 83 |
+
mse_features_plot = gr.Plot(label="MSE: Facial Features")
|
| 84 |
+
mse_features_hist = gr.Plot(label="MSE Distribution: Facial Features")
|
| 85 |
+
mse_features_heatmap = gr.Plot(label="MSE Heatmap: Facial Features")
|
| 86 |
+
anomaly_frames_features = gr.Gallery(label="Anomaly Frames (Facial Features)", columns=6, rows=2, height="auto")
|
| 87 |
+
face_samples_most_frequent = gr.Gallery(label="Most Frequent Person Samples", columns=10, rows=2, height="auto")
|
| 88 |
+
|
| 89 |
+
with gr.TabItem("Body Posture"):
|
| 90 |
+
mse_posture_plot = gr.Plot(label="MSE: Body Posture")
|
| 91 |
+
mse_posture_hist = gr.Plot(label="MSE Distribution: Body Posture")
|
| 92 |
+
mse_posture_heatmap = gr.Plot(label="MSE Heatmap: Body Posture")
|
| 93 |
+
anomaly_frames_posture = gr.Gallery(label="Anomaly Frames (Body Posture)", columns=6, rows=2, height="auto")
|
| 94 |
+
|
| 95 |
+
with gr.TabItem("Voice"):
|
| 96 |
+
mse_voice_plot = gr.Plot(label="MSE: Voice")
|
| 97 |
+
mse_voice_hist = gr.Plot(label="MSE Distribution: Voice")
|
| 98 |
+
mse_voice_heatmap = gr.Plot(label="MSE Heatmap: Voice")
|
| 99 |
+
|
| 100 |
+
with gr.TabItem("Combined"):
|
| 101 |
+
heatmap_video = gr.Video(label="Video with Anomaly Heatmap", visible=False)
|
| 102 |
+
combined_mse_plot = gr.Plot(label="Combined MSE Plot")
|
| 103 |
+
correlation_heatmap_plot = gr.Plot(label="Correlation Heatmap")
|
| 104 |
|
| 105 |
df_store = gr.State()
|
| 106 |
mse_features_store = gr.State()
|
|
|
|
| 130 |
).then(
|
| 131 |
show_results,
|
| 132 |
inputs=None,
|
| 133 |
+
outputs=[results_tabs, execution_time_group]
|
| 134 |
)
|
| 135 |
|
| 136 |
if __name__ == "__main__":
|