fsefon commited on
Commit
d4dab85
·
1 Parent(s): c1be374

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -1,12 +1,10 @@
1
- __all__ = ['learn', 'classify_image', 'categories',
2
- 'image', 'label', 'examples', 'intf']
3
 
4
  from fastai.vision.all import *
5
  import gradio as gr
6
 
7
- learn = load_learner('model.pkl')
8
 
9
- categories = ('Dinosaur', 'Not Dinosaur')
10
 
11
  def classify_image(img):
12
  pred, idx, probs = learn.predict(img)
@@ -14,7 +12,14 @@ def classify_image(img):
14
 
15
  image = gr.inputs.Image(shape=(192, 192))
16
  label = gr.outputs.Label()
17
- examples = ['dinosaur.png', 'not_dinosaur.png']
 
 
 
 
 
 
 
18
 
19
- intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
20
  intf.launch(inline=False)
 
 
 
1
 
2
  from fastai.vision.all import *
3
  import gradio as gr
4
 
5
+ learn=load_learner('sportball.pkl')
6
 
7
+ categories = ['soccer ball','basketball ball','golf ball','tennis ball','volleyball ball','Cricket ball']
8
 
9
  def classify_image(img):
10
  pred, idx, probs = learn.predict(img)
 
12
 
13
  image = gr.inputs.Image(shape=(192, 192))
14
  label = gr.outputs.Label()
15
+ examples = [
16
+ 'soccer_ball.jpg',
17
+ 'basketball_ball.jpg',
18
+ 'volleyball.jpg',
19
+ 'tennis_ball.jpg',
20
+ 'golf_ball.jpg',
21
+ 'cricket_ball.jpg'
22
+ ]
23
 
24
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples, title = "Sports Ball Recognition App", description = "This app can recognize different types of sport balls.")
25
  intf.launch(inline=False)