reab5555 commited on
Commit
d5b3c67
·
verified ·
1 Parent(s): ec74b6e

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] * 28
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, combined_mse_plot, combined_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 []
@@ -43,7 +43,7 @@ def process_and_show_completion(video_input_path, anomaly_threshold_input, fps,
43
  mse_embeddings, mse_posture, mse_voice,
44
  heatmap_video_path,
45
  correlation_heatmap,
46
- combined_mse_plot, combined_heatmap
47
  ]
48
 
49
  return output
@@ -53,7 +53,7 @@ def process_and_show_completion(video_input_path, anomaly_threshold_input, fps,
53
  print(error_message)
54
  import traceback
55
  traceback.print_exc()
56
- return [error_message] + [None] * 28
57
 
58
  def show_results(outputs):
59
  return gr.Group(visible=True)
@@ -99,7 +99,6 @@ with gr.Blocks() as iface:
99
  with gr.TabItem("Combined"):
100
  heatmap_video = gr.Video(label="Video with Anomaly Heatmap")
101
  combined_mse_plot = gr.Plot(label="Combined MSE Plot")
102
- combined_heatmap = gr.Plot(label="Combined Heatmap")
103
  correlation_heatmap_plot = gr.Plot(label="Correlation Heatmap")
104
 
105
  df_store = gr.State()
@@ -125,7 +124,7 @@ with gr.Blocks() as iface:
125
  face_samples_most_frequent,
126
  aligned_faces_folder_store, frames_folder_store,
127
  mse_heatmap_embeddings_store, mse_heatmap_posture_store, mse_heatmap_voice_store,
128
- heatmap_video, correlation_heatmap_plot, combined_mse_plot, combined_heatmap
129
  ]
130
  ).then(
131
  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] * 27
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, combined_mse_plot = 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 []
 
43
  mse_embeddings, mse_posture, mse_voice,
44
  heatmap_video_path,
45
  correlation_heatmap,
46
+ combined_mse_plot
47
  ]
48
 
49
  return output
 
53
  print(error_message)
54
  import traceback
55
  traceback.print_exc()
56
+ return [error_message] + [None] * 27
57
 
58
  def show_results(outputs):
59
  return gr.Group(visible=True)
 
99
  with gr.TabItem("Combined"):
100
  heatmap_video = gr.Video(label="Video with Anomaly Heatmap")
101
  combined_mse_plot = gr.Plot(label="Combined MSE Plot")
 
102
  correlation_heatmap_plot = gr.Plot(label="Correlation Heatmap")
103
 
104
  df_store = gr.State()
 
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, combined_heatmap
128
  ]
129
  ).then(
130
  show_results,