spaceappsexe / app.py
Kev09's picture
Update app.py
aa47eb9
raw
history blame contribute delete
995 Bytes
import gradio as gr
from inaFaceAnalyzer.inaFaceAnalyzer import ImageAnalyzer
import pandas as pd
def greet(name):
return "Hello " + name + "!!"
def fonc(img):
# create an image analyzer engine instance
ia = ImageAnalyzer()
res=ia(img)
sexe=res["sex_label"][0]
age=res["age_label"][0]
age=int(age)-4
age=str(age)
if str(sexe)=="m":
return "Vous êtes un homme"
else:
return "Vous êtes une femme"
with gr.Blocks(css="footer {visibility: hidden}") as demo:
# gr.Markdown("Start typing below and then click **Run** to see the output.")
# gr.HTML("<br>")
img1=gr.Image(type='filepath',tool=['editor', 'select'],show_label=False )
gr.HTML("<br>")
# out = gr.Textbox()
out=gr.Label(show_label=False)
gr.HTML("<br>")
btn = gr.Button("Run")
btn.click(fn=fonc, inputs=img1, outputs=out)
#iface = gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch(show_api=False)