File size: 407 Bytes
c3c5889
614f529
c3c5889
614f529
c3c5889
614f529
 
 
 
 
 
 
 
 
 
 
 
c3c5889
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
import fastbook

fastbook.setup_book()

from fastbook import *
from fastai.vision.widgets import *

learn = load_learner('bear_model.pkl')

categories = ("black", "grizzly", "teddy")

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

demo = gr.Interface(fn=classify_image, inputs="image", outputs="label")
demo.launch()