File size: 573 Bytes
901714b
68deada
7823f49
b9143a5
 
 
68deada
3db49ff
901714b
 
 
 
 
18ac803
10fd9e8
901714b
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from fastai.vision.all import *
import gradio as gr
import pickle
# import pathlib
# temp = pathlib.PosixPath
# pathlib.PosixPath = pathlib.WindowsPath

learn=load_learner('model (1).pkl')
categories=('man','woman')
def classify(img):
    pred,idx,prob=learn.predict(img)
    return dict(zip(categories,map(float,prob)))
image=gr.inputs.Image(shape=(192,192))
label=gr.outputs.Label()
examples = ["man.jpg", "woman.jpg"]
intf = gr.Interface(fn=classify, inputs=image,
                    outputs=label, examples=examples, title="Man or Woman !!!")
intf.launch(inline=False)