File size: 441 Bytes
7469680
 
5483778
7469680
5483778
d45ed02
5483778
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr

from fastbook import *


learn = load_learner('./model (1).pkl')

def predict(img):
  categories = learn.dls.vocab
  img = PILImage.create(img)
  category, idx, likelyhoods = learn.predict(img)

  return dict(zip(categories, map(float, likelyhoods)))

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



intf = gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=label).launch()