nothinglabs commited on
Commit
564df32
·
1 Parent(s): a05f597

here we go

Browse files
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -1,8 +1,19 @@
 
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()
 
 
 
 
 
 
 
 
 
 
 
8
 
 
1
+ from fastai.vision.all import *
2
  import gradio as gr
3
 
4
+ learn = load_learner("dog_detect.pkl")
 
5
 
6
+ def classify_image(img):
7
+ pred,idx,probs = learn.predict(img)
8
+ return dict(zip(learn.dls.vocab, map(float,probs)))
9
+
10
+ #im = PILImage.create("1.jpg")
11
+ #print (classify_image(im))
12
+
13
+ image = gr.inputs.Image(shape=(192,192))
14
+ label = gr.outputs.Label()
15
+ examples = ['golden.jpg', 'lab.jpg', 'corgi.jpg']
16
+
17
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
18
+ intf.launch(inline=False)
19