reab5555 commited on
Commit
f4e99d6
·
verified ·
1 Parent(s): 3fa5059

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] * 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,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
- stacked_heatmap, correlation_heatmap, output_video_path = 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 []
@@ -41,7 +41,7 @@ def process_and_show_completion(video_input_path, anomaly_threshold_input, fps,
41
  face_samples_frequent,
42
  aligned_faces_folder, frames_folder,
43
  mse_embeddings, mse_posture, mse_voice,
44
- stacked_heatmap, correlation_heatmap, output_video_path
45
  ]
46
 
47
  return output
@@ -51,7 +51,7 @@ def process_and_show_completion(video_input_path, anomaly_threshold_input, fps,
51
  print(error_message)
52
  import traceback
53
  traceback.print_exc()
54
- return [error_message] + [None] * 27
55
 
56
  def show_results(outputs):
57
  return gr.Group(visible=True)
@@ -100,7 +100,6 @@ with gr.Blocks() as iface:
100
  with gr.TabItem("Combined"):
101
  stacked_heatmap_plot = gr.Plot(label="Combined MSE Heatmaps")
102
  correlation_heatmap_plot = gr.Plot(label="Correlation Heatmap")
103
- output_video = gr.Video(label="Video with Heatmap")
104
 
105
  with gr.Row():
106
  with gr.Group(visible=True) as results_group2:
@@ -221,7 +220,7 @@ with gr.Blocks() as iface:
221
  face_samples_most_frequent,
222
  aligned_faces_folder_store, frames_folder_store,
223
  mse_heatmap_embeddings_store, mse_heatmap_posture_store, mse_heatmap_voice_store,
224
- stacked_heatmap_plot, correlation_heatmap_plot, output_video
225
  ]
226
  ).then(
227
  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
+ stacked_heatmap, 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 []
 
41
  face_samples_frequent,
42
  aligned_faces_folder, frames_folder,
43
  mse_embeddings, mse_posture, mse_voice,
44
+ stacked_heatmap, correlation_heatmap
45
  ]
46
 
47
  return output
 
51
  print(error_message)
52
  import traceback
53
  traceback.print_exc()
54
+ return [error_message] + [None] * 26
55
 
56
  def show_results(outputs):
57
  return gr.Group(visible=True)
 
100
  with gr.TabItem("Combined"):
101
  stacked_heatmap_plot = gr.Plot(label="Combined MSE Heatmaps")
102
  correlation_heatmap_plot = gr.Plot(label="Correlation Heatmap")
 
103
 
104
  with gr.Row():
105
  with gr.Group(visible=True) as results_group2:
 
220
  face_samples_most_frequent,
221
  aligned_faces_folder_store, frames_folder_store,
222
  mse_heatmap_embeddings_store, mse_heatmap_posture_store, mse_heatmap_voice_store,
223
+ stacked_heatmap_plot, correlation_heatmap_plot
224
  ]
225
  ).then(
226
  show_results,