soumenmaiti commited on
Commit
eb76bf3
1 Parent(s): 5665427
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -1,14 +1,19 @@
1
  import gradio as gr
2
  from fastai.vision.all import *
3
 
 
 
 
4
  learn = load_learner('model.pkl')
 
5
  categories =('dog','cat')
6
 
7
  def classify_image(img):
8
  pred,idx,probs = learn.predict(img)
9
  return dict(zip(categories,map(float,probs)))
10
- image = gr.inputs.image(shape=(192,192))
11
- label = gr.outputs.label()
 
12
  examples = ['dog.jpg','cat.jpg','dunno.jpg']
13
 
14
  demo = gr.Interface(fn=classify_image, inputs=image, outputs=label , examples=examples)
 
1
  import gradio as gr
2
  from fastai.vision.all import *
3
 
4
+ def is_cat(x): return x[0].isupper()
5
+
6
+
7
  learn = load_learner('model.pkl')
8
+
9
  categories =('dog','cat')
10
 
11
  def classify_image(img):
12
  pred,idx,probs = learn.predict(img)
13
  return dict(zip(categories,map(float,probs)))
14
+
15
+ image = gr.inputs.Image(shape=(192,192))
16
+ label = gr.outputs.Label()
17
  examples = ['dog.jpg','cat.jpg','dunno.jpg']
18
 
19
  demo = gr.Interface(fn=classify_image, inputs=image, outputs=label , examples=examples)