MaffHuggingFace commited on
Commit
b80bc29
1 Parent(s): 7007890

added model and images, replaced default gradio code

Browse files
app.py CHANGED
@@ -1,15 +1,15 @@
1
- from fastai.vision.all import *
2
  import gradio as gr
3
 
4
- def is_maths(x): return x[0].isupper()
5
 
6
- #learn = load_learner("model.pkl")
7
 
8
  categories = ('Make Noise Maths', 'Make Noise Mimeophon')
9
 
10
- # def classify_image(img):
11
- # pred,idx,probs = learn.predict(img)
12
- # return dict(zip(categories, map(float, probs)))
13
 
14
  image = gr.Image(type="pil")
15
  label = gr.Label()
@@ -18,11 +18,5 @@ examples = [
18
  "images/make-noise-mimeophon.jpg"
19
  ]
20
 
21
-
22
- #default gradio shizzle below
23
-
24
- def greet(name):
25
- return "Hello " + name + "!!"
26
-
27
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
28
- iface.launch()
 
1
+ from fastai.vision.all import load_learner
2
  import gradio as gr
3
 
4
+ # def is_maths(x): return x[0].isupper()
5
 
6
+ learn = load_learner("model.pkl")
7
 
8
  categories = ('Make Noise Maths', 'Make Noise Mimeophon')
9
 
10
+ def classify_image(img):
11
+ pred,idx,probs = learn.predict(img)
12
+ return dict(zip(categories, map(float, probs)))
13
 
14
  image = gr.Image(type="pil")
15
  label = gr.Label()
 
18
  "images/make-noise-mimeophon.jpg"
19
  ]
20
 
21
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
22
+ intf.launch(inline=False)
 
 
 
 
 
 
images/make-noise-maths.jpg ADDED
images/make-noise-mimeophon.jpg ADDED
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2cf6a4f14c2c69d5aaf61ceeaa58673d96be21464a53d3be6d9995db1eff8948
3
+ size 46955025