File size: 499 Bytes
262c091
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from fastai.vision.all import *
import gradio as gr

learner_madness = load_learner('madness.pkl')
categories = ['Hank', 'Tricky', 'Deimos', "Jeb", 'Sanford', 'The Auditor']

def classify_madness(img):
  prediction, index, probability = learner_madness.predict(img)
  return dict(zip(categories, map(float, probability)))

intf = gr.Interface(fn=classify_madness,
             inputs=gr.Image(shape=(192, 192)),
             outputs=gr.Label(),
             examples=[])
intf.launch(inline=False)