Brian Sigafoos commited on
Commit
3dd2b5e
1 Parent(s): 051daf1

Fix deprecation warning

Browse files
Files changed (2) hide show
  1. app.ipynb +15 -8
  2. app.py +6 -7
app.ipynb CHANGED
@@ -27,7 +27,7 @@
27
  "source": [
28
  "#|export\n",
29
  "from fastai.vision.all import *\n",
30
- "import gradio as gr"
31
  ]
32
  },
33
  {
@@ -108,9 +108,9 @@
108
  "metadata": {},
109
  "outputs": [],
110
  "source": [
111
- "# |export\n",
112
- "image = gr.inputs.Image(shape=(192, 192))\n",
113
- "label = gr.outputs.Label()\n",
114
  "examples = ['images/ash.jpg', 'images/chestnut.jpg', 'images/ginkgo_biloba.jpg',\n",
115
  " 'images/silver_maple.jpg', 'images/willow_oak.jpg']\n",
116
  "# More useful args\n",
@@ -119,10 +119,10 @@
119
  "article = \"<p>From this blog post: <a href='https://briansigafoos.com/ml-quick-start' target='_blank'>Machine Learning quick start by Brian Sigafoos</a></p>\"\n",
120
  "interpretation = 'default'\n",
121
  "\n",
122
- "interface = gr.Interface(fn=classify_image, inputs=image, outputs=label,\n",
123
- " examples=examples, title=title, description=description,\n",
124
- " article=article, interpretation=interpretation)\n",
125
- "interface.launch(inline=False)\n"
126
  ]
127
  },
128
  {
@@ -143,6 +143,13 @@
143
  "nb_export('app.ipynb', './')\n",
144
  "print('Export successful')"
145
  ]
 
 
 
 
 
 
 
146
  }
147
  ],
148
  "metadata": {
27
  "source": [
28
  "#|export\n",
29
  "from fastai.vision.all import *\n",
30
+ "import gradio"
31
  ]
32
  },
33
  {
108
  "metadata": {},
109
  "outputs": [],
110
  "source": [
111
+ "#|export\n",
112
+ "image = gradio.Image(shape=(192, 192))\n",
113
+ "label = gradio.Label()\n",
114
  "examples = ['images/ash.jpg', 'images/chestnut.jpg', 'images/ginkgo_biloba.jpg',\n",
115
  " 'images/silver_maple.jpg', 'images/willow_oak.jpg']\n",
116
  "# More useful args\n",
119
  "article = \"<p>From this blog post: <a href='https://briansigafoos.com/ml-quick-start' target='_blank'>Machine Learning quick start by Brian Sigafoos</a></p>\"\n",
120
  "interpretation = 'default'\n",
121
  "\n",
122
+ "interface = gradio.Interface(fn=classify_image, inputs=image, outputs=label,\n",
123
+ " examples=examples, title=title, description=description,\n",
124
+ " article=article, interpretation=interpretation)\n",
125
+ "interface.launch(inline=False)"
126
  ]
127
  },
128
  {
143
  "nb_export('app.ipynb', './')\n",
144
  "print('Export successful')"
145
  ]
146
+ },
147
+ {
148
+ "cell_type": "code",
149
+ "execution_count": null,
150
+ "metadata": {},
151
+ "outputs": [],
152
+ "source": []
153
  }
154
  ],
155
  "metadata": {
app.py CHANGED
@@ -6,7 +6,7 @@ __all__ = ['learn', 'categories', 'image', 'label', 'examples', 'title', 'descri
6
 
7
  # %% app.ipynb 2
8
  from fastai.vision.all import *
9
- import gradio as gr
10
 
11
  # %% app.ipynb 3
12
  learn = load_learner('model.pkl')
@@ -20,8 +20,8 @@ def classify_image(img):
20
  return dict(zip(categories, map(float, probs)))
21
 
22
  # %% app.ipynb 10
23
- image = gr.inputs.Image(shape=(192, 192))
24
- label = gr.outputs.Label()
25
  examples = ['images/ash.jpg', 'images/chestnut.jpg', 'images/ginkgo_biloba.jpg',
26
  'images/silver_maple.jpg', 'images/willow_oak.jpg']
27
  # More useful args
@@ -30,8 +30,7 @@ description = "A tree leaf classifier demo, trained on images downloaded from Du
30
  article = "<p>From this blog post: <a href='https://briansigafoos.com/ml-quick-start' target='_blank'>Machine Learning quick start by Brian Sigafoos</a></p>"
31
  interpretation = 'default'
32
 
33
- interface = gr.Interface(fn=classify_image, inputs=image, outputs=label,
34
- examples=examples, title=title, description=description,
35
- article=article, interpretation=interpretation)
36
  interface.launch(inline=False)
37
-
6
 
7
  # %% app.ipynb 2
8
  from fastai.vision.all import *
9
+ import gradio
10
 
11
  # %% app.ipynb 3
12
  learn = load_learner('model.pkl')
20
  return dict(zip(categories, map(float, probs)))
21
 
22
  # %% app.ipynb 10
23
+ image = gradio.Image(shape=(192, 192))
24
+ label = gradio.Label()
25
  examples = ['images/ash.jpg', 'images/chestnut.jpg', 'images/ginkgo_biloba.jpg',
26
  'images/silver_maple.jpg', 'images/willow_oak.jpg']
27
  # More useful args
30
  article = "<p>From this blog post: <a href='https://briansigafoos.com/ml-quick-start' target='_blank'>Machine Learning quick start by Brian Sigafoos</a></p>"
31
  interpretation = 'default'
32
 
33
+ interface = gradio.Interface(fn=classify_image, inputs=image, outputs=label,
34
+ examples=examples, title=title, description=description,
35
+ article=article, interpretation=interpretation)
36
  interface.launch(inline=False)