satish860 commited on
Commit
bca439e
1 Parent(s): 1741b1a
Files changed (3) hide show
  1. .ipynb_checkpoints/app-checkpoint.py +17 -0
  2. app.py +14 -4
  3. model.pkl +3 -0
.ipynb_checkpoints/app-checkpoint.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+
4
+ leaner = load_learner('model.pkl')
5
+ categories = ['black', 'grizzly', 'teddy']
6
+
7
+ def predict(img):
8
+ preds,idx,probs = leaner.predict(img)
9
+ return dict(zip(categories,map(float,probs)))
10
+
11
+
12
+
13
+ demo = gr.Interface(fn=predict,
14
+ inputs=gr.inputs.Image(shape=(224, 224)),
15
+ outputs= gr.outputs.Label()
16
+ )
17
+ demo.launch(inline=false)
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
  import gradio as gr
2
+ from fastai.vision.all import *
3
 
4
+ leaner = load_learner('model.pkl')
5
+ categories = ['black', 'grizzly', 'teddy']
6
 
7
+ def predict(img):
8
+ preds,idx,probs = leaner.predict(img)
9
+ return dict(zip(categories,map(float,probs)))
10
+
11
+
12
+
13
+ demo = gr.Interface(fn=predict,
14
+ inputs=gr.inputs.Image(shape=(224, 224)),
15
+ outputs= gr.outputs.Label()
16
+ )
17
+ demo.launch(inline=false)
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c2b4e4ff272d5b27e405baf5fe6e07b3e00a49e9d29c3c5106f1988fdada1f63
3
+ size 46968929