import gradio as gr import pandas as pd from deepface import DeepFace def analyze(img_path): face_analysis = DeepFace.analyze(img_path = img_path, enforce_detection=False) return pd.DataFrame([{ 'gender': face_analysis.get('gender', None), 'age': face_analysis.get('age', None), 'dominant_emotion': face_analysis.get('dominant_emotion', None), 'dominant_race': face_analysis.get('dominant_race', None) }]) def main(): demo = gr.Interface( fn=analyze, inputs=gr.Image(type="filepath", source="webcam"), outputs="dataframe" ) demo.launch() if __name__ == "__main__": main()