sarmadahmad8 commited on
Commit
7416f8c
1 Parent(s): 27180e3

Add application file

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -1,7 +1,14 @@
 
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
+ from fastai.vision.all import *
2
  import gradio as gr
3
 
4
+ def is_cat(x) : return x[0].isupper()
5
+ learn = load_learner('model.pkl')
6
 
7
+ categories = ('Cat','Dog')
8
+
9
+ def classify_images(img):
10
+ pred,idx,probs = learn.predict(img)
11
+ return dict(zip(categories,map(float,probs)))
12
+
13
+ intf=gr.Interface(fn=classify_images,inputs=gr.Image(height=192,width=192),outputs=gr.Label(),examples=['dog.jpg','cat.jpg','dunno.jpg'])
14
+ intf.launch()