import gradio as gr from app.app_utils import preprocess_frame_and_predict_aus def create_facs_analysis_tab(pth_model_static, pth_model_dynamic, cam): def analyze_facs(frame): cur_face, au_intensities, heatmap = preprocess_frame_and_predict_aus(frame) return cur_face, heatmap, au_intensities with gr.Row(): with gr.Column(): input_image = gr.Image(type="numpy", label="Upload a Frame") analyze_button = gr.Button("Analyze") with gr.Column(): output_face = gr.Image(type="numpy", label="Detected Face") output_heatmap = gr.Image(type="numpy", label="Heatmap") output_aus = gr.Label(label="AU Intensities") analyze_button.click(analyze_facs, inputs=[input_image], outputs=[output_face, output_heatmap, output_aus]) return gr.Row([input_image, analyze_button, output_face, output_heatmap, output_aus])