File size: 470 Bytes
33b5143
 
 
 
 
 
 
 
 
 
 
 
 
 
ffe36a0
6fe2844
33b5143
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
from fastai.vision.all  import *


def is_marth(x): return x[0].isupper()

# Model
learn = load_learner("model.pkl")

# Categories
categories = ("Marth", "Sheik")


def classify_images(img):
    pred, idx, probs = learn.predict(img)
    return dict(zip(categories, map(float, probs)))

image = gr.inputs.Image(shape = (192, 192))
label = gr.outputs.Label()


intf = gr.Interface(fn = classify_images, inputs = image, outputs = label)  

intf.launch()