Spaces:
Runtime error
Runtime error
| 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) |