iamyatin commited on
Commit
409b6c1
1 Parent(s): 0fdf522

feat: Test out the Pet breeds

Browse files
Files changed (2) hide show
  1. app.py +17 -4
  2. export.pkl +3 -0
app.py CHANGED
@@ -1,7 +1,20 @@
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
 
4
+ learn = load_learner('export.pkl')
 
5
 
6
+ def classify_image(img):
7
+ pred, pred_idx, probs = learn.predict(img)
8
+ return dict(zip(learn.dls.vocab, map(float, probs)))
9
+
10
+ # def greet(name):
11
+ # return "Hello " + name + "!!"
12
+
13
+ image = gr.Image(height=192, width=192)
14
+
15
+ intf = gr.Interface(fn=classify_image,
16
+ inputs=image,
17
+ outputs='label'
18
+ )
19
+
20
+ intf.launch(inline=False)
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5ff9c22c165cd5ae647c3b509a863e4edbc7de843529e2d8d74f0b2cb154972c
3
+ size 103057644