benja20029
Change of model
62748ed
from fastai.vision.all import *
import gradio as gr
def emotion(x): return x[0].isupper()
learn = load_learner('emotion_classifier_model.pkl')
categories = ('angry', 'anxious', 'calm', 'disgusted','happy', 'sad', 'scared')
def classify_images(img):
pred,idx,probs = learn.predict(img)
return dict(zip(categories, map(float,probs)))
image = gr.Image(shape=(192,192))
label = gr.Label()
examples = ['emotions/scared.jpg', 'emotions/happy.jpg', 'emotions/sad.jpg', 'emotions/angry.jpg']
intf = gr.Interface(fn=classify_images, inputs=image, outputs=label, examples=examples)
intf.launch(inline=False)