ErickMVdO commited on
Commit
ae01a09
1 Parent(s): da97b7e
Files changed (2) hide show
  1. app.py +15 -4
  2. guitars.pkl +3 -0
app.py CHANGED
@@ -1,7 +1,18 @@
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
  import gradio as gr
2
+ from fastai.vision.all import *
3
+ import skimage
4
 
5
+ learn = load_learner('guitars.pkl')
 
6
 
7
+ labels = learn.dls.vocab
8
+ def predict(img):
9
+ img = PILImage.create(img)
10
+ pred,pred_idx,probs = learn.predict(img)
11
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
12
+
13
+ title = "Guitar Classifier"
14
+ examples = ['Telecaste.jpg', 'Les_Paul.jpg', 'Stratocaster.jpg', 'SG.jpg', 'Flying_V.jpg', 'Explorer.jpg']
15
+ interpretation='default'
16
+ enable_queue=True
17
+
18
+ gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=5),title=title,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()
guitars.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:86e514251fd2b5adfcecf28683929a9f9a6a5abed780f499311bacb7a84d746c
3
+ size 46980641