jaybeeja commited on
Commit
f5aca6b
1 Parent(s): d21d2c0

Trombone Classifier

Browse files
Files changed (4) hide show
  1. app.py +9 -4
  2. trombones.pkl +3 -0
  3. trombones/__init__.py +1 -0
  4. trombones/app.py +11 -0
app.py CHANGED
@@ -1,7 +1,12 @@
 
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
+ from fastai.vision.all import *
2
  import gradio as gr
3
 
4
+ learn = load_learner('trombones.pkl')
5
+ categories = learn.dls.vocab
6
 
7
+ def predict(img):
8
+ img = PILImage.create(img)
9
+ pred, pred_idx, probs = learn.predict(img)
10
+ return dict(zip(categories, map(float, probs)))
11
+
12
+ gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(224, 224)), outputs=gr.outputs.Label()).launch(inline=False)
trombones.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8c44e2f7c07f5d89b694e3b93a9a0d4637cebe918c15ad3bf7d5fe786baaf02e
3
+ size 242082501
trombones/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ __version__ = "0.0.1"
trombones/app.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: ../trombones.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learn']
5
+
6
+ # %% ../trombones.ipynb 1
7
+ from fastai.vision.all import *
8
+ import gradio as gr
9
+
10
+ # %% ../trombones.ipynb 2
11
+ learn = load_learner('trombones.pkl')