elsoori commited on
Commit
cbf1ce6
·
1 Parent(s): 23a73c5

working code

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -1,18 +1,15 @@
1
- from fastai.vision.all import *
2
- import gradio as gr
3
-
4
  learn = load_learner('model.pkl')
5
 
6
- categories = ('black, 'grizzly', 'teddy')
7
  def classify_image(img):
8
  pred,idx,probs = learn.predict(img)
9
  return dict(zip(categories, map(float,probs)))
10
 
11
  title = "Bear Classifier"
12
- description = "This classifier can help you identify if the image you uploaded is of a \n 1. Grizzly Bear \n 2.Black Bear \n 3.Teddy Bear \n"
13
  image = gr.Image(shape=(192,192))
14
  label = gr.Label()
15
  examples = ['grizzly.jpg', 'black.jpg', 'teddy.jpg']
16
 
17
- intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples = examples, title=title, description= description)
18
  intf.launch(inline=False)
 
 
 
 
1
  learn = load_learner('model.pkl')
2
 
3
+ categories = ('black', 'grizzly', 'teddy')
4
  def classify_image(img):
5
  pred,idx,probs = learn.predict(img)
6
  return dict(zip(categories, map(float,probs)))
7
 
8
  title = "Bear Classifier"
9
+
10
  image = gr.Image(shape=(192,192))
11
  label = gr.Label()
12
  examples = ['grizzly.jpg', 'black.jpg', 'teddy.jpg']
13
 
14
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples = examples, title=title)
15
  intf.launch(inline=False)