bear_classifier / app.py
李根赢
GHOST
bba1729
raw
history blame
904 Bytes
# AUTOGENERATED! DO NOT EDIT! File to edit: gdrive/MyDrive/Colab Notebooks/Untitled8.ipynb.
# %% auto 0
__all__ = ['path', 'learn_inf', 'btn_upload', 'img', 'out_pl']
# %% gdrive/MyDrive/Colab Notebooks/Untitled8.ipynb 25
from fastai.vision.widgets import *
from fastai.vision.all import *
import gradio as gr
# %% gdrive/MyDrive/Colab Notebooks/Untitled8.ipynb 26
path = Path('bears')
learn_inf = load_learner(path/'export.pkl')
# %% gdrive/MyDrive/Colab Notebooks/Untitled8.ipynb 27
btn_upload = widgets.FileUpload()
btn_upload
# %% gdrive/MyDrive/Colab Notebooks/Untitled8.ipynb 28
btn_upload = SimpleNamespace(data = ['images/grizzly.jpg'])
# %% gdrive/MyDrive/Colab Notebooks/Untitled8.ipynb 29
img = PILImage.create(btn_upload.data[-1])
# %% gdrive/MyDrive/Colab Notebooks/Untitled8.ipynb 30
out_pl = widgets.Output()
out_pl.clear_output()
with out_pl: display(img.to_thumb(128,128))
out_pl