Spaces:
Runtime error
Runtime error
import gradio as gr | |
from app.app_utils import preprocess_video_and_predict | |
def clear_dynamic_info(): | |
return [gr.Video(value=None)] * 4 + [gr.Plot(value=None)] | |
def create_face_expressions_tab(): | |
with gr.Row(): | |
with gr.Column(scale=1): | |
input_video = gr.Video(elem_classes="video1") | |
with gr.Row(): | |
clear_btn = gr.Button("Clear") | |
submit_btn = gr.Button("Analyze", elem_classes="submit") | |
with gr.Column(scale=1, elem_classes="dl4"): | |
output_videos = [ | |
gr.Video(label=label, elem_classes=f"video{i+2}") | |
for i, label in enumerate(["Original video", "Pre-processed video", "Heatmaps"]) | |
] | |
output_statistics = gr.Plot(label="Statistics of emotions", elem_classes="stat") | |
submit_btn.click( | |
fn=preprocess_video_and_predict, | |
inputs=input_video, | |
outputs=output_videos + [output_statistics], | |
queue=True, | |
) | |
clear_btn.click( | |
fn=clear_dynamic_info, | |
outputs=[input_video] + output_videos + [output_statistics], | |
queue=True, | |
) | |
gr.Examples(["./assets/videos/fitness.mp4"], inputs=[input_video]) |