Spaces:
Runtime error
Runtime error
__all__ = ['learner_faces', 'categories', 'classify_faces', 'image', 'label', 'examples', 'intf'] | |
from fastai.vision.all import * | |
import gradio as gr | |
learner_faces = load_learner('faces_resenet50_78.pk1') | |
categories = ['happy', 'sad', 'angry'] | |
def classify_faces(img): | |
prediction, index, probability = learner_pets.predict(img) | |
return dict(zip(categories, map(float, probability))) | |
intf = gr.Interface(fn=classify_faces, | |
inputs=gr.Image(shape=(192, 192)), | |
outputs=gr.Label(), | |
examples=['face01', 'face13', `face02`, 'face07', `face10`, `face11`, `face03`,` face04`, `face12`, `face05`, `face09`, `face06`, `face08`, `face09` ]) | |
intf.launch(inline=False) | |