File size: 636 Bytes
625ab2a
 
 
fc58835
 
 
 
625ab2a
 
 
 
fc58835
 
 
625ab2a
 
 
 
 
 
20fac57
625ab2a
4f748bb
 
 
625ab2a
 
e4c7268
625ab2a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from fastai.vision.all import * 
import gradio as gr 

# # get image 
# im=PILImage.create("dog.jpg")
# im.thumbnail((255,255))
# im 


# export 
learn=load_learner('model.pkl')
categories=("Impressionist", "Romanticist", "Realist")
# # learns on image 
# learn.predict(im)


# gradi orequires function 
def classify_img(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()
# examples=['i.jpg', 'r.jpg','re.jpg']


intf=gr.Interface(fn=classify_img,inputs=gr.Image(type="pil"),outputs=gr.Label()) 
intf.launch(inline=False)