ConnerLee/Experiments
1
1# AUTOGENERATED! DO NOT EDIT! File to edit: ../Hotdog Detector(FastAI Lesson 2).ipynb.2 3# %% auto 04__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'classify_image']5 6# %% ../Hotdog Detector(FastAI Lesson 2).ipynb 17from fastai.vision.all import *8import gradio as gr9 10# %% ../Hotdog Detector(FastAI Lesson 2).ipynb 411learn = load_learner('export.pkl')12 13# %% ../Hotdog Detector(FastAI Lesson 2).ipynb 614categories = ('hotdog','not hotdog')15 16def classify_image(img):17 pred,idx,probs = learn.predict(img)18 return dict(zip(categories, map(float,probs)))19 20# %% ../Hotdog Detector(FastAI Lesson 2).ipynb 821image = gr.components.Image(height = 192, width = 192)22label = gr.components.Label()23examples = ['hotdog.jpg','dog.jpg']24 25intf = gr.Interface(fn = classify_image, inputs = image, outputs = label, examples = examples)26intf.launch(inline = False)27 