Brian Sigafoos commited on
Commit
835040b
1 Parent(s): 4aabb1b

Add model notebook and app.py

Browse files
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ .ipynb_checkpoints/
2
+ trees/
.python-version DELETED
@@ -1 +0,0 @@
1
- 3.9
 
 
app.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
app.py CHANGED
@@ -1,7 +1,20 @@
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learn', 'categories', 'classify_image']
5
+
6
+ # %% app.ipynb 2
7
+ from fastai.vision.all import *
8
  import gradio as gr
9
 
10
+ # %% app.ipynb 3
11
+ learn = load_learner('model.pkl')
12
+
13
+ # %% app.ipynb 7
14
+ # NOTE: Put in alphabetical order
15
+ categories = ('ash', 'chestnut', 'ginkgo biloba', 'silver maple', 'willow oak')
16
 
17
+ def classify_image(img):
18
+ pred, idx, probs = learn.predict(img)
19
+ # Change each probability to a float, since Gradio doesn't support Tensors or NumPy
20
+ return dict(zip(categories, map(float, probs)))
images/ash.jpg ADDED
images/chestnut.jpg ADDED
images/ginkgo_biloba.jpg ADDED
images/silver_maple.jpg ADDED
images/tree.jpg ADDED
images/willow_oak.jpg ADDED
model.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f040356bc64b3b08d0804b78d6e662e55225f73073ec7a5506dc8192bf9f8bba
3
+ size 46964477
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ scikit-image