Yunij commited on
Commit
7ee056a
1 Parent(s): 49bdebc
Files changed (1) hide show
  1. app.py +8 -40
app.py CHANGED
@@ -1,61 +1,29 @@
1
- #!/usr/bin/env python
2
- # coding: utf-8
3
-
4
- # In[12]:
5
 
 
 
6
 
 
7
  import gradio as gr
8
 
9
 
10
- # In[13]:
11
-
12
-
13
  from fastai.vision.all import *
14
 
15
-
16
- # In[14]:
17
-
18
-
19
  learn = load_learner('model.pkl')
20
 
21
-
22
- # In[15]:
23
-
24
-
25
  categories = {'Ronaldo', 'messi', 'Michael Jordan', 'Rafael Nadal', 'Roger Federer'}
26
 
27
  def classify_athlete(img):
28
  pred,idx,probs = learn.predict(img)
29
  return dict(zip(categories, map(float,probs)))
30
 
31
-
32
- # In[21]:
33
-
34
-
35
- classify_athlete('cr7.jpeg')
36
-
37
-
38
- # In[26]:
39
-
40
-
41
  image = gr.inputs.Image(shape = (192,192))
42
  label = gr.outputs.Label()
43
  examples = ['cr7.jpeg','messi.jpeg','michael_jordan.jpeg']
44
 
45
  intf = gr.Interface(fn = classify_athlete,inputs = image, outputs = label, examples = examples)
46
  intf.launch(inline = False)
47
-
48
-
49
- # # Making and exporting a python script
50
-
51
- # In[34]:
52
-
53
-
54
- get_ipython().system('jupyter nbconvert --to script app.ipynb')
55
-
56
-
57
- # In[ ]:
58
-
59
-
60
-
61
-
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
 
 
 
2
 
3
+ # %% auto 0
4
+ __all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'classify_athlete']
5
 
6
+ # %% app.ipynb 1
7
  import gradio as gr
8
 
9
 
10
+ # %% app.ipynb 2
 
 
11
  from fastai.vision.all import *
12
 
13
+ # %% app.ipynb 3
 
 
 
14
  learn = load_learner('model.pkl')
15
 
16
+ # %% app.ipynb 4
 
 
 
17
  categories = {'Ronaldo', 'messi', 'Michael Jordan', 'Rafael Nadal', 'Roger Federer'}
18
 
19
  def classify_athlete(img):
20
  pred,idx,probs = learn.predict(img)
21
  return dict(zip(categories, map(float,probs)))
22
 
23
+ # %% app.ipynb 6
 
 
 
 
 
 
 
 
 
24
  image = gr.inputs.Image(shape = (192,192))
25
  label = gr.outputs.Label()
26
  examples = ['cr7.jpeg','messi.jpeg','michael_jordan.jpeg']
27
 
28
  intf = gr.Interface(fn = classify_athlete,inputs = image, outputs = label, examples = examples)
29
  intf.launch(inline = False)