File size: 492 Bytes
3c92de6
997dd91
 
e96e91a
3c92de6
6d59a4b
31ec730
 
997dd91
 
69b3097
997dd91
 
 
 
3c92de6
5de835d
31ec730
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from fastcore.all import *
import time
from fastai.vision.all import *

image = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label()
examples = ['bmw_750.jpeg']
categories = ['bmw car', 'mercedes car']

learn = load_learner("export.pkl")

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

intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
intf.launch(inline=False)