Spaces:
Runtime error
Runtime error
# AUTOGENERATED! DO NOT EDIT! File to edit: ../../A_Practical_Deep_Learning/Untitled.ipynb. | |
# %% auto 0 | |
__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'is_cat', 'classify_image'] | |
# %% ../../A_Practical_Deep_Learning/Untitled.ipynb 1 | |
from fastai.vision.all import * | |
import gradio as gr | |
def is_cat(x): return x[0].isupper() | |
# %% ../../A_Practical_Deep_Learning/Untitled.ipynb 4 | |
learn = load_learner("model (1).pkl") | |
# %% ../../A_Practical_Deep_Learning/Untitled.ipynb 6 | |
categories = ('Dog', 'Cat') | |
def classify_image(img): | |
pred,idx,probs = learn.predict(img) | |
return dict(zip(categories, map(float,probs))) | |
# %% ../../A_Practical_Deep_Learning/Untitled.ipynb 8 | |
image = gr.components.Image(shape=(192,192)) | |
label = gr.components.Label() | |
# examples = [r"C:\Users\Kush\Downloads\dog.jpg", r"C:\Users\Kush\Downloads\scared-hamster.jpg", r"C:\Users\Kush\Downloads\Converse Welcomes Baby Keem to the Family.png"] | |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label) | |
intf.launch(inline=False, share=True) | |
# %% | |