reab5555 commited on
Commit
3dff9c0
·
verified ·
1 Parent(s): d76a2e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -15,7 +15,7 @@ def process_and_show_completion(video_input_path, anomaly_threshold_input, fps,
15
 
16
  if isinstance(results[0], str) and results[0].startswith("Error"):
17
  print(f"Error occurred: {results[0]}")
18
- return [results[0]] + [None] * 24
19
 
20
  exec_time, results_summary, df, mse_embeddings, mse_posture, mse_voice, \
21
  mse_plot_embeddings, mse_plot_posture, mse_plot_voice, \
@@ -24,7 +24,8 @@ def process_and_show_completion(video_input_path, anomaly_threshold_input, fps,
24
  face_samples_frequent, \
25
  anomaly_faces_embeddings, anomaly_frames_posture_images, \
26
  aligned_faces_folder, frames_folder, \
27
- heatmap_video_path, correlation_heatmap = results
 
28
 
29
  anomaly_faces_embeddings_pil = [Image.fromarray(face) for face in anomaly_faces_embeddings] if anomaly_faces_embeddings is not None else []
30
  anomaly_frames_posture_pil = [Image.fromarray(frame) for frame in anomaly_frames_posture_images] if anomaly_frames_posture_images is not None else []
@@ -42,7 +43,8 @@ def process_and_show_completion(video_input_path, anomaly_threshold_input, fps,
42
  aligned_faces_folder, frames_folder,
43
  mse_embeddings, mse_posture, mse_voice,
44
  heatmap_video_path,
45
- correlation_heatmap
 
46
  ]
47
 
48
  return output
@@ -52,7 +54,7 @@ def process_and_show_completion(video_input_path, anomaly_threshold_input, fps,
52
  print(error_message)
53
  import traceback
54
  traceback.print_exc()
55
- return [error_message] + [None] * 24
56
 
57
  def show_results(outputs):
58
  return gr.Group(visible=True)
@@ -97,6 +99,8 @@ with gr.Blocks() as iface:
97
 
98
  with gr.TabItem("Combined"):
99
  heatmap_video = gr.Video(label="Video with Anomaly Heatmap")
 
 
100
  correlation_heatmap_plot = gr.Plot(label="Correlation Heatmap")
101
 
102
  df_store = gr.State()
@@ -122,7 +126,7 @@ with gr.Blocks() as iface:
122
  face_samples_most_frequent,
123
  aligned_faces_folder_store, frames_folder_store,
124
  mse_heatmap_embeddings_store, mse_heatmap_posture_store, mse_heatmap_voice_store,
125
- heatmap_video, correlation_heatmap_plot
126
  ]
127
  ).then(
128
  show_results,
 
15
 
16
  if isinstance(results[0], str) and results[0].startswith("Error"):
17
  print(f"Error occurred: {results[0]}")
18
+ return [results[0]] + [None] * 26
19
 
20
  exec_time, results_summary, df, mse_embeddings, mse_posture, mse_voice, \
21
  mse_plot_embeddings, mse_plot_posture, mse_plot_voice, \
 
24
  face_samples_frequent, \
25
  anomaly_faces_embeddings, anomaly_frames_posture_images, \
26
  aligned_faces_folder, frames_folder, \
27
+ heatmap_video_path, correlation_heatmap,
28
+ combined_mse_plot, combined_heatmap = results
29
 
30
  anomaly_faces_embeddings_pil = [Image.fromarray(face) for face in anomaly_faces_embeddings] if anomaly_faces_embeddings is not None else []
31
  anomaly_frames_posture_pil = [Image.fromarray(frame) for frame in anomaly_frames_posture_images] if anomaly_frames_posture_images is not None else []
 
43
  aligned_faces_folder, frames_folder,
44
  mse_embeddings, mse_posture, mse_voice,
45
  heatmap_video_path,
46
+ correlation_heatmap,
47
+ combined_mse_plot, combined_heatmap
48
  ]
49
 
50
  return output
 
54
  print(error_message)
55
  import traceback
56
  traceback.print_exc()
57
+ return [error_message] + [None] * 26
58
 
59
  def show_results(outputs):
60
  return gr.Group(visible=True)
 
99
 
100
  with gr.TabItem("Combined"):
101
  heatmap_video = gr.Video(label="Video with Anomaly Heatmap")
102
+ combined_mse_plot = gr.Plot(label="Combined MSE Plot")
103
+ combined_heatmap = gr.Plot(label="Combined Heatmap")
104
  correlation_heatmap_plot = gr.Plot(label="Correlation Heatmap")
105
 
106
  df_store = gr.State()
 
126
  face_samples_most_frequent,
127
  aligned_faces_folder_store, frames_folder_store,
128
  mse_heatmap_embeddings_store, mse_heatmap_posture_store, mse_heatmap_voice_store,
129
+ heatmap_video, correlation_heatmap_plot, combined_mse_plot, combined_heatmap
130
  ]
131
  ).then(
132
  show_results,