Spaces:
Sleeping
Sleeping
File size: 499 Bytes
27db284 23d8165 27db284 e7a2819 23d8165 27db284 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from fastai.vision.all import *
import gradio as gr
learner = load_learner('emotion_model.pkl')
face_types = learner.dls.vocab
def classify_image(img):
pred, indx, probs = learner.predict(img)
return dict(zip(face_types, map(float,probs)))
image = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label()
examples = ['happy.jpg', 'sad.jpg', 'nervous.jpg', 'yawning.jpg']
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
intf.launch(inline=False)
|