hancav's picture
Update app.py
9dbc6ca
raw
history blame contribute delete
452 Bytes
from deepface import DeepFace
import gradio as gr
def face_analysis(img):
face_analysis = DeepFace.analyze(img_path = img)
emotion = face_analysis[0]["dominant_emotion"]
gender = face_analysis[0]["dominant_gender"]
age = face_analysis[0]["age"]
race = face_analysis[0]["dominant_race"]
return("This is a " + str(gender) + ", " + str(age) + " years old and is " + str(emotion))
gr.Interface(face_analysis,"image","text").launch(share=True)