Xenopilus commited on
Commit
8abc411
1 Parent(s): 4a6b1dd
Files changed (8) hide show
  1. app.py +14 -4
  2. bicycle1.jpg +0 -0
  3. bicycle2.jpg +0 -0
  4. car1.jpg +0 -0
  5. car2.jpg +0 -0
  6. truck1.jpg +0 -0
  7. truck2.jpg +0 -0
  8. veicle_model.pkl +3 -0
app.py CHANGED
@@ -1,7 +1,17 @@
 
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('veicle_model.pkl')
 
5
 
6
+ categories = ('Car', 'Bicycle', 'Truck lorry')
7
+
8
+ def classify_image(img):
9
+ pred,idx,probs = learn.predict(img)
10
+ return dict(zip(categories, map(float,probs)))
11
+
12
+ image = gr.inputs.Image(shape=(192, 192))
13
+ label = gr.outputs.Label()
14
+
15
+ exaples = ['car1.jpg', 'car2.jpg', 'bicycle1.jpg', 'bicycle2.jpg', 'truck1.jpg', 'truck2.jpg']
16
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
17
+ intf.lounch(inline=False)
bicycle1.jpg ADDED
bicycle2.jpg ADDED
car1.jpg ADDED
car2.jpg ADDED
truck1.jpg ADDED
truck2.jpg ADDED
veicle_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:154c532dd0f871b0a733baa7d3727cfd1da724a0d3242453d9750fe735967c65
3
+ size 46965926