ved1beta commited on
Commit
9fe9116
·
1 Parent(s): 424ce0d
Files changed (1) hide show
  1. app.py +13 -7
app.py CHANGED
@@ -1,7 +1,13 @@
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
+ __all__={'is_cat', "learn" , "classify_image", 'categories', 'image', 'label', 'examples' ,'intf'}
2
+ from fastai.vision.all import *
3
+ import gradio as gr
4
+ learn= load_learner('model.pkl')
5
+ categories=('Dog','Cat')
6
+ def classify_image(img):
7
+ pred,idx,probs=learn.predict(img)
8
+ return dict(zip(categories, map(float,probs)))
9
+ image = gr.components.Image(label="Image Input")
10
+ label= gr.components.Label(label="Image Input")
11
+ examples = ['dog.jpg','cat.jpg','0002a367-38b4-41c3-a47c-b11e104b394b.jpg']
12
+ intf=gr.Interface(fn=classify_image, inputs=image, outputs=label , examples=examples)
13
+ intf.launch(inline= False)