bear_classifier / app.py
李根赢
GHOST
6a40026
raw
history blame
940 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
from IPython.display import display
# %% 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