Spaces:
Runtime error
Runtime error
Upload 5 files
Browse filesUploaded application file, requirements, and examples images
Files changed (5)
- app.pyAdded+41
- examples/eevee.jpgAdded
- examples/panda.jpgAdded
- examples/renamon.jpgAdded
- requirements.txtAdded+2
1234567891011121314151617181920212223242526272829303132333435363738394041# AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
# %% auto 0__all__ = ['path', 'learn', 'labels', 'title', 'description', 'pred']
# %% ../app.ipynb 2from fastai.vision.all import *import gradio as grfrom nbdev.export import nb_export
# %% ../app.ipynb 3path = Path()# path.ls(file_exts='.pkl')
# %% ../app.ipynb 5learn = load_learner(path/'model.pkl')
# %% ../app.ipynb 6labels = learn.dls.vocab #['animals', 'digimons', 'pokemon']
# %% ../app.ipynb 26def pred(img): img = PILImage.create(img) pred, pred_idx, prob = learn.predict(img) return {labels[i]: float(prob[i]) for i in range(len(labels))}
# %% ../app.ipynb 28title = 'Pokemon, Digimon, or Animal?'description = '''Pokemon and Digimon are popular franchises with many monster designs, as described by their titles (Pocket Monsters and Digital Monsters, respectively). Many lot of their designs are based on or take inspiration from real animals. Despite this, people familiar with at least one of these franchises can usually discern these monsters as Pokemon or Digimon. This model attempts to do the same.'''
gr.Interface(fn=pred, inputs=gr.Image(type='pil', sources=['upload', 'clipboard']), outputs='label', title=title, description=description, examples='examples', theme='gradio/monochrome').launch()12fastai==2.7.12gradio==4.8.0app.pyAdded+41
examples/eevee.jpgAdded

examples/panda.jpgAdded

examples/renamon.jpgAdded

requirements.txtAdded+2