File size: 457 Bytes
8b41d91
 
 
 
 
77ed6d8
8b41d91
77ed6d8
8b41d91
 
 
 
9e68da6
e68d663
 
d9b7e36
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
__all__ = ['learn', 'classify_image', 'categories', 'image', 'label', 'intf']

from fastai.vision.all import *
import gradio as gr

learn = load_learner('export (3).pkl')

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

image=gr.Image()
label = gr.Label()
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
intf.launch()