Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,8 +3,9 @@ import time
|
|
| 3 |
from video_processing import process_video
|
| 4 |
from PIL import Image
|
| 5 |
import matplotlib
|
| 6 |
-
|
| 7 |
-
matplotlib.rcParams['
|
|
|
|
| 8 |
|
| 9 |
def process_and_show_completion(video_input_path, anomaly_threshold_input, fps, progress=gr.Progress()):
|
| 10 |
try:
|
|
@@ -20,7 +21,7 @@ def process_and_show_completion(video_input_path, anomaly_threshold_input, fps,
|
|
| 20 |
mse_plot_embeddings, mse_histogram_embeddings, \
|
| 21 |
mse_plot_posture, mse_histogram_posture, \
|
| 22 |
mse_heatmap_embeddings, mse_heatmap_posture, \
|
| 23 |
-
face_samples_frequent,
|
| 24 |
anomaly_faces_embeddings, anomaly_frames_posture_images, \
|
| 25 |
aligned_faces_folder, frames_folder = results
|
| 26 |
|
|
@@ -37,7 +38,7 @@ def process_and_show_completion(video_input_path, anomaly_threshold_input, fps,
|
|
| 37 |
mse_histogram_embeddings, mse_histogram_posture,
|
| 38 |
mse_heatmap_embeddings, mse_heatmap_posture,
|
| 39 |
anomaly_faces_embeddings_pil, anomaly_frames_posture_pil,
|
| 40 |
-
face_samples_frequent,
|
| 41 |
aligned_faces_folder, frames_folder,
|
| 42 |
mse_embeddings, mse_posture,
|
| 43 |
]
|
|
@@ -76,7 +77,7 @@ with gr.Blocks() as iface:
|
|
| 76 |
mse_features_hist = gr.Plot(label="MSE Distribution: Facial Features")
|
| 77 |
mse_features_heatmap = gr.Plot(label="MSE Heatmap: Facial Features")
|
| 78 |
anomaly_frames_features = gr.Gallery(label="Anomaly Frames (Facial Features)", columns=6, rows=2, height="auto")
|
| 79 |
-
|
| 80 |
#face_samples_others = gr.Gallery(label="Other Samples", columns=6, rows=1, height="auto")
|
| 81 |
|
| 82 |
with gr.Tab("Body Posture"):
|
|
@@ -103,7 +104,7 @@ with gr.Blocks() as iface:
|
|
| 103 |
mse_features_hist, mse_posture_hist,
|
| 104 |
mse_features_heatmap, mse_posture_heatmap,
|
| 105 |
anomaly_frames_features, anomaly_frames_posture,
|
| 106 |
-
face_samples_most_frequent,
|
| 107 |
aligned_faces_folder_store, frames_folder_store,
|
| 108 |
mse_heatmap_embeddings_store, mse_heatmap_posture_store
|
| 109 |
]
|
|
|
|
| 3 |
from video_processing import process_video
|
| 4 |
from PIL import Image
|
| 5 |
import matplotlib
|
| 6 |
+
|
| 7 |
+
matplotlib.rcParams['figure.dpi'] = 400
|
| 8 |
+
matplotlib.rcParams['savefig.dpi'] = 400
|
| 9 |
|
| 10 |
def process_and_show_completion(video_input_path, anomaly_threshold_input, fps, progress=gr.Progress()):
|
| 11 |
try:
|
|
|
|
| 21 |
mse_plot_embeddings, mse_histogram_embeddings, \
|
| 22 |
mse_plot_posture, mse_histogram_posture, \
|
| 23 |
mse_heatmap_embeddings, mse_heatmap_posture, \
|
| 24 |
+
face_samples_frequent, \
|
| 25 |
anomaly_faces_embeddings, anomaly_frames_posture_images, \
|
| 26 |
aligned_faces_folder, frames_folder = results
|
| 27 |
|
|
|
|
| 38 |
mse_histogram_embeddings, mse_histogram_posture,
|
| 39 |
mse_heatmap_embeddings, mse_heatmap_posture,
|
| 40 |
anomaly_faces_embeddings_pil, anomaly_frames_posture_pil,
|
| 41 |
+
face_samples_frequent,
|
| 42 |
aligned_faces_folder, frames_folder,
|
| 43 |
mse_embeddings, mse_posture,
|
| 44 |
]
|
|
|
|
| 77 |
mse_features_hist = gr.Plot(label="MSE Distribution: Facial Features")
|
| 78 |
mse_features_heatmap = gr.Plot(label="MSE Heatmap: Facial Features")
|
| 79 |
anomaly_frames_features = gr.Gallery(label="Anomaly Frames (Facial Features)", columns=6, rows=2, height="auto")
|
| 80 |
+
face_samples_most_frequent = gr.Gallery(label="Other Samples", columns=10, rows=2, height="auto")
|
| 81 |
#face_samples_others = gr.Gallery(label="Other Samples", columns=6, rows=1, height="auto")
|
| 82 |
|
| 83 |
with gr.Tab("Body Posture"):
|
|
|
|
| 104 |
mse_features_hist, mse_posture_hist,
|
| 105 |
mse_features_heatmap, mse_posture_heatmap,
|
| 106 |
anomaly_frames_features, anomaly_frames_posture,
|
| 107 |
+
face_samples_most_frequent,
|
| 108 |
aligned_faces_folder_store, frames_folder_store,
|
| 109 |
mse_heatmap_embeddings_store, mse_heatmap_posture_store
|
| 110 |
]
|