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