jmparejaz's picture
Update app.py
0b78266
raw
history blame
675 Bytes
import gradio as gr
from huggingface_hub import from_pretrained_keras
import numpy as np
import logging
#
def rgb2gray(rgb):
return np.dot(rgb[...,:3], [0.2989, 0.5870, 0.1140])
def fun(a):
reloaded_model = from_pretrained_keras('jmparejaz/Facial_Age-gender-eth_Recognition')
reloaded_model_eth = from_pretrained_keras('jmparejaz/Facial_eth_recognition')
#img=load_img(a, grayscale=True)
a=a.reshape((-1,48,48,1))
pred=reloaded_model.predict(a)
pred_eth=reloaded_model_eth.predict(a)
return pred[0][0][0],pred[1][0][0],pred_eth
gr.Interface(fn=fun, inputs=gr.inputs.Image(shape=(48,48)), outputs=["text","text","label"]).launch()