File size: 660 Bytes
ef464de 272de03 ccce8d5 272de03 ccce8d5 ef464de 52d594d ef464de 52d594d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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() |