anglesplato commited on
Commit
e41be54
·
verified ·
1 Parent(s): e6a1e00

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -7
app.py CHANGED
@@ -1,7 +1,21 @@
1
- import gradio as gr
2
-
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
-
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+
4
+ categories = ('Dog', 'Cat')
5
+ learn = load_learner('model1.pk1')
6
+ def classify_image(img):
7
+ pred , idx , probs = learn.predict(img)
8
+ return dict(zip(categories , map(float,probs)))
9
+
10
+
11
+
12
+ image = gr.inputs.image(shape=(192 ,192))
13
+ label = gr.outputs.Label()
14
+ examples = ['dog.jpg', 'cat.jpg', 'dumo.jpg']
15
+ demo = gr.Interface(fn=classify_image, inputs=image, outputs= label)
16
+ demo.launch(inline = False)
17
+
18
+ m = learn.model
19
+ ps = list(m.parameters())
20
+
21
+ ps[1]