Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,6 +19,9 @@ import gradio as gr
|
|
| 19 |
import tempfile
|
| 20 |
import shutil
|
| 21 |
import subprocess
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
# Initialize models and other global variables
|
| 24 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
|
@@ -387,7 +390,6 @@ def process_video(video_path, num_anomalies, num_components, desired_fps, batch_
|
|
| 387 |
progress(1.0, "Complete")
|
| 388 |
return results, anomaly_plot, emotion_plots[0], emotion_plots[1], emotion_plots[2]
|
| 389 |
|
| 390 |
-
# Updated Gradio interface
|
| 391 |
iface = gr.Interface(
|
| 392 |
fn=process_video,
|
| 393 |
inputs=[
|
|
@@ -399,10 +401,10 @@ iface = gr.Interface(
|
|
| 399 |
],
|
| 400 |
outputs=[
|
| 401 |
gr.Textbox(label="Anomaly Detection Results"),
|
| 402 |
-
gr.Plot(label="Anomaly Scores")
|
| 403 |
-
gr.Plot(label="Fear Scores")
|
| 404 |
-
gr.Plot(label="Sad Scores")
|
| 405 |
-
gr.Plot(label="Angry Scores")
|
| 406 |
],
|
| 407 |
title="Facial Expressions Anomaly Detection",
|
| 408 |
description="""
|
|
|
|
| 19 |
import tempfile
|
| 20 |
import shutil
|
| 21 |
import subprocess
|
| 22 |
+
import tensorflow as tf
|
| 23 |
+
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
|
| 24 |
+
tf.get_logger().setLevel('ERROR')
|
| 25 |
|
| 26 |
# Initialize models and other global variables
|
| 27 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
|
|
|
| 390 |
progress(1.0, "Complete")
|
| 391 |
return results, anomaly_plot, emotion_plots[0], emotion_plots[1], emotion_plots[2]
|
| 392 |
|
|
|
|
| 393 |
iface = gr.Interface(
|
| 394 |
fn=process_video,
|
| 395 |
inputs=[
|
|
|
|
| 401 |
],
|
| 402 |
outputs=[
|
| 403 |
gr.Textbox(label="Anomaly Detection Results"),
|
| 404 |
+
gr.Plot(label="Anomaly Scores"),
|
| 405 |
+
gr.Plot(label="Fear Scores"),
|
| 406 |
+
gr.Plot(label="Sad Scores"),
|
| 407 |
+
gr.Plot(label="Angry Scores")
|
| 408 |
],
|
| 409 |
title="Facial Expressions Anomaly Detection",
|
| 410 |
description="""
|