reab5555 commited on
Commit
f5180ea
·
verified ·
1 Parent(s): 4aaff7a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
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] * 25
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,7 @@ 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, scatter_plot_3d = 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 +42,7 @@ 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, scatter_plot_3d
46
  ]
47
 
48
  return output
@@ -52,7 +52,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] * 25
56
 
57
  def show_results(outputs):
58
  return gr.Group(visible=True)
@@ -99,7 +99,6 @@ with gr.Blocks() as iface:
99
  with gr.TabItem("Video with Heatmap"):
100
  heatmap_video = gr.Video(label="Video with Anomaly Heatmap")
101
  correlation_heatmap_plot = gr.Plot(label="Correlation Heatmap")
102
- scatter_plot_3d_plot = gr.Plot(label="3D Scatter Plot of MSEs")
103
 
104
  df_store = gr.State()
105
  mse_features_store = gr.State()
@@ -124,7 +123,7 @@ with gr.Blocks() as iface:
124
  face_samples_most_frequent,
125
  aligned_faces_folder_store, frames_folder_store,
126
  mse_heatmap_embeddings_store, mse_heatmap_posture_store, mse_heatmap_voice_store,
127
- heatmap_video, correlation_heatmap_plot, scatter_plot_3d_plot
128
  ]
129
  ).then(
130
  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] * 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
  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
  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
  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)
 
99
  with gr.TabItem("Video with Heatmap"):
100
  heatmap_video = gr.Video(label="Video with Anomaly Heatmap")
101
  correlation_heatmap_plot = gr.Plot(label="Correlation Heatmap")
 
102
 
103
  df_store = gr.State()
104
  mse_features_store = gr.State()
 
123
  face_samples_most_frequent,
124
  aligned_faces_folder_store, frames_folder_store,
125
  mse_heatmap_embeddings_store, mse_heatmap_posture_store, mse_heatmap_voice_store,
126
+ heatmap_video, correlation_heatmap_plot
127
  ]
128
  ).then(
129
  show_results,