Spaces:
Sleeping
Sleeping
Aspiring Astro
commited on
Commit
·
06c7cb9
1
Parent(s):
856d9db
fix image size
Browse files
app.ipynb
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
},
|
13 |
{
|
14 |
"cell_type": "code",
|
15 |
-
"execution_count":
|
16 |
"id": "d6810835-d62a-4f94-a52e-0e0cd163fb98",
|
17 |
"metadata": {},
|
18 |
"outputs": [],
|
@@ -26,7 +26,7 @@
|
|
26 |
},
|
27 |
{
|
28 |
"cell_type": "code",
|
29 |
-
"execution_count":
|
30 |
"id": "6092ad61-d5cd-40f7-b2d2-20a77b0c8b0f",
|
31 |
"metadata": {},
|
32 |
"outputs": [],
|
@@ -46,7 +46,7 @@
|
|
46 |
},
|
47 |
{
|
48 |
"cell_type": "code",
|
49 |
-
"execution_count":
|
50 |
"id": "632cbc1b-73b5-4992-8956-d4ae40f6b80b",
|
51 |
"metadata": {},
|
52 |
"outputs": [],
|
@@ -62,10 +62,379 @@
|
|
62 |
},
|
63 |
{
|
64 |
"cell_type": "code",
|
65 |
-
"execution_count":
|
66 |
"id": "9b5f1cc6-5173-475a-9365-0cab11db2d03",
|
67 |
"metadata": {},
|
68 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
"source": [
|
70 |
"example_images = [ 'cheetah.jpg', 'jaguar.jpg', 'tiger.jpg', 'cougar.jpg', 'lion.jpg', 'african leopard.jpg', 'clouded leopard.jpg', 'snow leopard.jpg' ]\n",
|
71 |
"\n",
|
@@ -77,13 +446,85 @@
|
|
77 |
},
|
78 |
{
|
79 |
"cell_type": "code",
|
80 |
-
"execution_count":
|
81 |
"id": "a48e7483-c04b-4048-a1ae-34a8c7986a57",
|
82 |
"metadata": {},
|
83 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
"source": [
|
85 |
"#| export\n",
|
86 |
-
"image = gr.inputs.Image(
|
87 |
"model = gr.inputs.Dropdown(choices=models)\n",
|
88 |
"label = gr.outputs.Label()\n",
|
89 |
"example_images = [ 'cheetah.jpg', 'jaguar.jpg', 'tiger.jpg', 'cougar.jpg', 'lion.jpg', 'african leopard.jpg', 'clouded leopard.jpg', 'snow leopard.jpg' ]\n",
|
@@ -95,10 +536,18 @@
|
|
95 |
},
|
96 |
{
|
97 |
"cell_type": "code",
|
98 |
-
"execution_count":
|
99 |
"id": "cab071f9-7c3b-4b35-a0d1-3687731ffce5",
|
100 |
"metadata": {},
|
101 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
"source": [
|
103 |
"import nbdev\n",
|
104 |
"nbdev.export.nb_export('app.ipynb', './')\n",
|
|
|
12 |
},
|
13 |
{
|
14 |
"cell_type": "code",
|
15 |
+
"execution_count": 2,
|
16 |
"id": "d6810835-d62a-4f94-a52e-0e0cd163fb98",
|
17 |
"metadata": {},
|
18 |
"outputs": [],
|
|
|
26 |
},
|
27 |
{
|
28 |
"cell_type": "code",
|
29 |
+
"execution_count": 3,
|
30 |
"id": "6092ad61-d5cd-40f7-b2d2-20a77b0c8b0f",
|
31 |
"metadata": {},
|
32 |
"outputs": [],
|
|
|
46 |
},
|
47 |
{
|
48 |
"cell_type": "code",
|
49 |
+
"execution_count": 4,
|
50 |
"id": "632cbc1b-73b5-4992-8956-d4ae40f6b80b",
|
51 |
"metadata": {},
|
52 |
"outputs": [],
|
|
|
62 |
},
|
63 |
{
|
64 |
"cell_type": "code",
|
65 |
+
"execution_count": 5,
|
66 |
"id": "9b5f1cc6-5173-475a-9365-0cab11db2d03",
|
67 |
"metadata": {},
|
68 |
+
"outputs": [
|
69 |
+
{
|
70 |
+
"data": {
|
71 |
+
"text/html": [
|
72 |
+
"\n",
|
73 |
+
"<style>\n",
|
74 |
+
" /* Turns off some styling */\n",
|
75 |
+
" progress {\n",
|
76 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
77 |
+
" border: none;\n",
|
78 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
79 |
+
" background-size: auto;\n",
|
80 |
+
" }\n",
|
81 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
82 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
83 |
+
" }\n",
|
84 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
85 |
+
" background: #F44336;\n",
|
86 |
+
" }\n",
|
87 |
+
"</style>\n"
|
88 |
+
],
|
89 |
+
"text/plain": [
|
90 |
+
"<IPython.core.display.HTML object>"
|
91 |
+
]
|
92 |
+
},
|
93 |
+
"metadata": {},
|
94 |
+
"output_type": "display_data"
|
95 |
+
},
|
96 |
+
{
|
97 |
+
"data": {
|
98 |
+
"text/html": [],
|
99 |
+
"text/plain": [
|
100 |
+
"<IPython.core.display.HTML object>"
|
101 |
+
]
|
102 |
+
},
|
103 |
+
"metadata": {},
|
104 |
+
"output_type": "display_data"
|
105 |
+
},
|
106 |
+
{
|
107 |
+
"name": "stdout",
|
108 |
+
"output_type": "stream",
|
109 |
+
"text": [
|
110 |
+
"cheetah TensorBase(1) TensorBase([2.9325e-08, 9.9999e-01, 1.2872e-09, 1.3284e-05, 3.6218e-08,\n",
|
111 |
+
" 6.6378e-07, 1.2428e-08, 7.0062e-09])\n",
|
112 |
+
"{'african leopard': 2.932508635922204e-08, 'cheetah': 0.9999860525131226, 'clouded leopard': 1.2872064525382143e-09, 'cougar': 1.3283532098284923e-05, 'jaguar': 3.6217517873637917e-08, 'lion': 6.637808382947696e-07, 'snow leopard': 1.242834812842375e-08, 'tiger': 7.0062102786039304e-09}\n"
|
113 |
+
]
|
114 |
+
},
|
115 |
+
{
|
116 |
+
"data": {
|
117 |
+
"text/html": [
|
118 |
+
"\n",
|
119 |
+
"<style>\n",
|
120 |
+
" /* Turns off some styling */\n",
|
121 |
+
" progress {\n",
|
122 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
123 |
+
" border: none;\n",
|
124 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
125 |
+
" background-size: auto;\n",
|
126 |
+
" }\n",
|
127 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
128 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
129 |
+
" }\n",
|
130 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
131 |
+
" background: #F44336;\n",
|
132 |
+
" }\n",
|
133 |
+
"</style>\n"
|
134 |
+
],
|
135 |
+
"text/plain": [
|
136 |
+
"<IPython.core.display.HTML object>"
|
137 |
+
]
|
138 |
+
},
|
139 |
+
"metadata": {},
|
140 |
+
"output_type": "display_data"
|
141 |
+
},
|
142 |
+
{
|
143 |
+
"data": {
|
144 |
+
"text/html": [],
|
145 |
+
"text/plain": [
|
146 |
+
"<IPython.core.display.HTML object>"
|
147 |
+
]
|
148 |
+
},
|
149 |
+
"metadata": {},
|
150 |
+
"output_type": "display_data"
|
151 |
+
},
|
152 |
+
{
|
153 |
+
"name": "stdout",
|
154 |
+
"output_type": "stream",
|
155 |
+
"text": [
|
156 |
+
"jaguar TensorBase(4) TensorBase([2.2414e-06, 4.8124e-07, 1.5911e-08, 1.5741e-08, 1.0000e+00,\n",
|
157 |
+
" 8.4150e-10, 2.4537e-08, 4.5623e-07])\n",
|
158 |
+
"{'african leopard': 2.241393531221547e-06, 'cheetah': 4.812366114492761e-07, 'clouded leopard': 1.5911437500903958e-08, 'cougar': 1.5740527103957902e-08, 'jaguar': 0.9999967813491821, 'lion': 8.415030339214979e-10, 'snow leopard': 2.453731973162121e-08, 'tiger': 4.562308788536029e-07}\n"
|
159 |
+
]
|
160 |
+
},
|
161 |
+
{
|
162 |
+
"data": {
|
163 |
+
"text/html": [
|
164 |
+
"\n",
|
165 |
+
"<style>\n",
|
166 |
+
" /* Turns off some styling */\n",
|
167 |
+
" progress {\n",
|
168 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
169 |
+
" border: none;\n",
|
170 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
171 |
+
" background-size: auto;\n",
|
172 |
+
" }\n",
|
173 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
174 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
175 |
+
" }\n",
|
176 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
177 |
+
" background: #F44336;\n",
|
178 |
+
" }\n",
|
179 |
+
"</style>\n"
|
180 |
+
],
|
181 |
+
"text/plain": [
|
182 |
+
"<IPython.core.display.HTML object>"
|
183 |
+
]
|
184 |
+
},
|
185 |
+
"metadata": {},
|
186 |
+
"output_type": "display_data"
|
187 |
+
},
|
188 |
+
{
|
189 |
+
"data": {
|
190 |
+
"text/html": [],
|
191 |
+
"text/plain": [
|
192 |
+
"<IPython.core.display.HTML object>"
|
193 |
+
]
|
194 |
+
},
|
195 |
+
"metadata": {},
|
196 |
+
"output_type": "display_data"
|
197 |
+
},
|
198 |
+
{
|
199 |
+
"name": "stdout",
|
200 |
+
"output_type": "stream",
|
201 |
+
"text": [
|
202 |
+
"tiger TensorBase(7) TensorBase([2.0140e-08, 3.2289e-10, 3.0278e-07, 1.7037e-07, 2.8471e-08,\n",
|
203 |
+
" 3.1560e-08, 5.5170e-08, 1.0000e+00])\n",
|
204 |
+
"{'african leopard': 2.0139752976433556e-08, 'cheetah': 3.228871059413052e-10, 'clouded leopard': 3.0278118856585934e-07, 'cougar': 1.7037031341260445e-07, 'jaguar': 2.8470973134631095e-08, 'lion': 3.15602726175257e-08, 'snow leopard': 5.5169955714973185e-08, 'tiger': 0.9999994039535522}\n"
|
205 |
+
]
|
206 |
+
},
|
207 |
+
{
|
208 |
+
"data": {
|
209 |
+
"text/html": [
|
210 |
+
"\n",
|
211 |
+
"<style>\n",
|
212 |
+
" /* Turns off some styling */\n",
|
213 |
+
" progress {\n",
|
214 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
215 |
+
" border: none;\n",
|
216 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
217 |
+
" background-size: auto;\n",
|
218 |
+
" }\n",
|
219 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
220 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
221 |
+
" }\n",
|
222 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
223 |
+
" background: #F44336;\n",
|
224 |
+
" }\n",
|
225 |
+
"</style>\n"
|
226 |
+
],
|
227 |
+
"text/plain": [
|
228 |
+
"<IPython.core.display.HTML object>"
|
229 |
+
]
|
230 |
+
},
|
231 |
+
"metadata": {},
|
232 |
+
"output_type": "display_data"
|
233 |
+
},
|
234 |
+
{
|
235 |
+
"data": {
|
236 |
+
"text/html": [],
|
237 |
+
"text/plain": [
|
238 |
+
"<IPython.core.display.HTML object>"
|
239 |
+
]
|
240 |
+
},
|
241 |
+
"metadata": {},
|
242 |
+
"output_type": "display_data"
|
243 |
+
},
|
244 |
+
{
|
245 |
+
"name": "stdout",
|
246 |
+
"output_type": "stream",
|
247 |
+
"text": [
|
248 |
+
"cougar TensorBase(3) TensorBase([7.7202e-04, 9.6453e-05, 3.6239e-04, 9.9550e-01, 5.8073e-04,\n",
|
249 |
+
" 1.0296e-03, 1.6978e-04, 1.4883e-03])\n",
|
250 |
+
"{'african leopard': 0.0007720203138887882, 'cheetah': 9.645262616686523e-05, 'clouded leopard': 0.00036238841130398214, 'cougar': 0.9955006241798401, 'jaguar': 0.0005807342822663486, 'lion': 0.0010295877000316978, 'snow leopard': 0.000169777573319152, 'tiger': 0.0014882636023685336}\n"
|
251 |
+
]
|
252 |
+
},
|
253 |
+
{
|
254 |
+
"data": {
|
255 |
+
"text/html": [
|
256 |
+
"\n",
|
257 |
+
"<style>\n",
|
258 |
+
" /* Turns off some styling */\n",
|
259 |
+
" progress {\n",
|
260 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
261 |
+
" border: none;\n",
|
262 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
263 |
+
" background-size: auto;\n",
|
264 |
+
" }\n",
|
265 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
266 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
267 |
+
" }\n",
|
268 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
269 |
+
" background: #F44336;\n",
|
270 |
+
" }\n",
|
271 |
+
"</style>\n"
|
272 |
+
],
|
273 |
+
"text/plain": [
|
274 |
+
"<IPython.core.display.HTML object>"
|
275 |
+
]
|
276 |
+
},
|
277 |
+
"metadata": {},
|
278 |
+
"output_type": "display_data"
|
279 |
+
},
|
280 |
+
{
|
281 |
+
"data": {
|
282 |
+
"text/html": [],
|
283 |
+
"text/plain": [
|
284 |
+
"<IPython.core.display.HTML object>"
|
285 |
+
]
|
286 |
+
},
|
287 |
+
"metadata": {},
|
288 |
+
"output_type": "display_data"
|
289 |
+
},
|
290 |
+
{
|
291 |
+
"name": "stdout",
|
292 |
+
"output_type": "stream",
|
293 |
+
"text": [
|
294 |
+
"lion TensorBase(5) TensorBase([6.3666e-10, 2.1585e-07, 6.5407e-09, 1.1020e-08, 1.3697e-08,\n",
|
295 |
+
" 9.9998e-01, 5.2166e-09, 1.6965e-05])\n",
|
296 |
+
"{'african leopard': 6.366598359619502e-10, 'cheetah': 2.1584540377261874e-07, 'clouded leopard': 6.540694652557022e-09, 'cougar': 1.1020346413204152e-08, 'jaguar': 1.3696873857327319e-08, 'lion': 0.9999828338623047, 'snow leopard': 5.2166360120509125e-09, 'tiger': 1.696465005807113e-05}\n"
|
297 |
+
]
|
298 |
+
},
|
299 |
+
{
|
300 |
+
"data": {
|
301 |
+
"text/html": [
|
302 |
+
"\n",
|
303 |
+
"<style>\n",
|
304 |
+
" /* Turns off some styling */\n",
|
305 |
+
" progress {\n",
|
306 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
307 |
+
" border: none;\n",
|
308 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
309 |
+
" background-size: auto;\n",
|
310 |
+
" }\n",
|
311 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
312 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
313 |
+
" }\n",
|
314 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
315 |
+
" background: #F44336;\n",
|
316 |
+
" }\n",
|
317 |
+
"</style>\n"
|
318 |
+
],
|
319 |
+
"text/plain": [
|
320 |
+
"<IPython.core.display.HTML object>"
|
321 |
+
]
|
322 |
+
},
|
323 |
+
"metadata": {},
|
324 |
+
"output_type": "display_data"
|
325 |
+
},
|
326 |
+
{
|
327 |
+
"data": {
|
328 |
+
"text/html": [],
|
329 |
+
"text/plain": [
|
330 |
+
"<IPython.core.display.HTML object>"
|
331 |
+
]
|
332 |
+
},
|
333 |
+
"metadata": {},
|
334 |
+
"output_type": "display_data"
|
335 |
+
},
|
336 |
+
{
|
337 |
+
"name": "stdout",
|
338 |
+
"output_type": "stream",
|
339 |
+
"text": [
|
340 |
+
"african leopard TensorBase(0) TensorBase([9.7809e-01, 1.9370e-03, 5.1859e-04, 1.8196e-05, 1.5251e-02,\n",
|
341 |
+
" 1.8402e-04, 3.8208e-03, 1.8130e-04])\n",
|
342 |
+
"{'african leopard': 0.9780895113945007, 'cheetah': 0.0019370485097169876, 'clouded leopard': 0.0005185850313864648, 'cougar': 1.819587851059623e-05, 'jaguar': 0.015250639989972115, 'lion': 0.00018402353452984244, 'snow leopard': 0.0038208006881177425, 'tiger': 0.00018130325770471245}\n"
|
343 |
+
]
|
344 |
+
},
|
345 |
+
{
|
346 |
+
"data": {
|
347 |
+
"text/html": [
|
348 |
+
"\n",
|
349 |
+
"<style>\n",
|
350 |
+
" /* Turns off some styling */\n",
|
351 |
+
" progress {\n",
|
352 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
353 |
+
" border: none;\n",
|
354 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
355 |
+
" background-size: auto;\n",
|
356 |
+
" }\n",
|
357 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
358 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
359 |
+
" }\n",
|
360 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
361 |
+
" background: #F44336;\n",
|
362 |
+
" }\n",
|
363 |
+
"</style>\n"
|
364 |
+
],
|
365 |
+
"text/plain": [
|
366 |
+
"<IPython.core.display.HTML object>"
|
367 |
+
]
|
368 |
+
},
|
369 |
+
"metadata": {},
|
370 |
+
"output_type": "display_data"
|
371 |
+
},
|
372 |
+
{
|
373 |
+
"data": {
|
374 |
+
"text/html": [],
|
375 |
+
"text/plain": [
|
376 |
+
"<IPython.core.display.HTML object>"
|
377 |
+
]
|
378 |
+
},
|
379 |
+
"metadata": {},
|
380 |
+
"output_type": "display_data"
|
381 |
+
},
|
382 |
+
{
|
383 |
+
"name": "stdout",
|
384 |
+
"output_type": "stream",
|
385 |
+
"text": [
|
386 |
+
"clouded leopard TensorBase(2) TensorBase([3.5035e-05, 2.8548e-06, 9.9938e-01, 1.8297e-06, 5.6521e-04,\n",
|
387 |
+
" 1.3141e-06, 7.5178e-06, 1.0570e-05])\n",
|
388 |
+
"{'african leopard': 3.5035314795095474e-05, 'cheetah': 2.8547888177854475e-06, 'clouded leopard': 0.9993757605552673, 'cougar': 1.8296907455805922e-06, 'jaguar': 0.0005652108229696751, 'lion': 1.314112978434423e-06, 'snow leopard': 7.517839094361989e-06, 'tiger': 1.0569940059212968e-05}\n"
|
389 |
+
]
|
390 |
+
},
|
391 |
+
{
|
392 |
+
"data": {
|
393 |
+
"text/html": [
|
394 |
+
"\n",
|
395 |
+
"<style>\n",
|
396 |
+
" /* Turns off some styling */\n",
|
397 |
+
" progress {\n",
|
398 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
399 |
+
" border: none;\n",
|
400 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
401 |
+
" background-size: auto;\n",
|
402 |
+
" }\n",
|
403 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
404 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
405 |
+
" }\n",
|
406 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
407 |
+
" background: #F44336;\n",
|
408 |
+
" }\n",
|
409 |
+
"</style>\n"
|
410 |
+
],
|
411 |
+
"text/plain": [
|
412 |
+
"<IPython.core.display.HTML object>"
|
413 |
+
]
|
414 |
+
},
|
415 |
+
"metadata": {},
|
416 |
+
"output_type": "display_data"
|
417 |
+
},
|
418 |
+
{
|
419 |
+
"data": {
|
420 |
+
"text/html": [],
|
421 |
+
"text/plain": [
|
422 |
+
"<IPython.core.display.HTML object>"
|
423 |
+
]
|
424 |
+
},
|
425 |
+
"metadata": {},
|
426 |
+
"output_type": "display_data"
|
427 |
+
},
|
428 |
+
{
|
429 |
+
"name": "stdout",
|
430 |
+
"output_type": "stream",
|
431 |
+
"text": [
|
432 |
+
"snow leopard TensorBase(6) TensorBase([1.9796e-07, 5.2659e-07, 1.7047e-04, 2.0246e-07, 1.5801e-08,\n",
|
433 |
+
" 5.4288e-06, 9.9982e-01, 6.8012e-09])\n",
|
434 |
+
"{'african leopard': 1.9796296157892357e-07, 'cheetah': 5.265908384899376e-07, 'clouded leopard': 0.00017047168512362987, 'cougar': 2.024643492859468e-07, 'jaguar': 1.5801049357833108e-08, 'lion': 5.4287702369038016e-06, 'snow leopard': 0.9998231530189514, 'tiger': 6.801158747293812e-09}\n"
|
435 |
+
]
|
436 |
+
}
|
437 |
+
],
|
438 |
"source": [
|
439 |
"example_images = [ 'cheetah.jpg', 'jaguar.jpg', 'tiger.jpg', 'cougar.jpg', 'lion.jpg', 'african leopard.jpg', 'clouded leopard.jpg', 'snow leopard.jpg' ]\n",
|
440 |
"\n",
|
|
|
446 |
},
|
447 |
{
|
448 |
"cell_type": "code",
|
449 |
+
"execution_count": 7,
|
450 |
"id": "a48e7483-c04b-4048-a1ae-34a8c7986a57",
|
451 |
"metadata": {},
|
452 |
+
"outputs": [
|
453 |
+
{
|
454 |
+
"name": "stderr",
|
455 |
+
"output_type": "stream",
|
456 |
+
"text": [
|
457 |
+
"/Users/ajithj/Library/Python/3.8/lib/python/site-packages/gradio/inputs.py:256: UserWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n",
|
458 |
+
" warnings.warn(\n",
|
459 |
+
"/Users/ajithj/Library/Python/3.8/lib/python/site-packages/gradio/deprecation.py:40: UserWarning: `optional` parameter is deprecated, and it has no effect\n",
|
460 |
+
" warnings.warn(value)\n",
|
461 |
+
"/Users/ajithj/Library/Python/3.8/lib/python/site-packages/gradio/inputs.py:216: UserWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n",
|
462 |
+
" warnings.warn(\n",
|
463 |
+
"/Users/ajithj/Library/Python/3.8/lib/python/site-packages/gradio/outputs.py:196: UserWarning: Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components\n",
|
464 |
+
" warnings.warn(\n",
|
465 |
+
"/Users/ajithj/Library/Python/3.8/lib/python/site-packages/gradio/deprecation.py:40: UserWarning: The 'type' parameter has been deprecated. Use the Number component instead.\n",
|
466 |
+
" warnings.warn(value)\n"
|
467 |
+
]
|
468 |
+
},
|
469 |
+
{
|
470 |
+
"name": "stdout",
|
471 |
+
"output_type": "stream",
|
472 |
+
"text": [
|
473 |
+
"Running on local URL: http://127.0.0.1:7860\n",
|
474 |
+
"\n",
|
475 |
+
"To create a public link, set `share=True` in `launch()`.\n"
|
476 |
+
]
|
477 |
+
},
|
478 |
+
{
|
479 |
+
"data": {
|
480 |
+
"text/html": [
|
481 |
+
"\n",
|
482 |
+
"<style>\n",
|
483 |
+
" /* Turns off some styling */\n",
|
484 |
+
" progress {\n",
|
485 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
486 |
+
" border: none;\n",
|
487 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
488 |
+
" background-size: auto;\n",
|
489 |
+
" }\n",
|
490 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
491 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
492 |
+
" }\n",
|
493 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
494 |
+
" background: #F44336;\n",
|
495 |
+
" }\n",
|
496 |
+
"</style>\n"
|
497 |
+
],
|
498 |
+
"text/plain": [
|
499 |
+
"<IPython.core.display.HTML object>"
|
500 |
+
]
|
501 |
+
},
|
502 |
+
"metadata": {},
|
503 |
+
"output_type": "display_data"
|
504 |
+
},
|
505 |
+
{
|
506 |
+
"data": {
|
507 |
+
"text/html": [],
|
508 |
+
"text/plain": [
|
509 |
+
"<IPython.core.display.HTML object>"
|
510 |
+
]
|
511 |
+
},
|
512 |
+
"metadata": {},
|
513 |
+
"output_type": "display_data"
|
514 |
+
},
|
515 |
+
{
|
516 |
+
"name": "stdout",
|
517 |
+
"output_type": "stream",
|
518 |
+
"text": [
|
519 |
+
"cheetah TensorBase(1) TensorBase([2.9325e-08, 9.9999e-01, 1.2872e-09, 1.3284e-05, 3.6218e-08,\n",
|
520 |
+
" 6.6378e-07, 1.2428e-08, 7.0062e-09])\n",
|
521 |
+
"Keyboard interruption in main thread... closing server.\n"
|
522 |
+
]
|
523 |
+
}
|
524 |
+
],
|
525 |
"source": [
|
526 |
"#| export\n",
|
527 |
+
"image = gr.inputs.Image()\n",
|
528 |
"model = gr.inputs.Dropdown(choices=models)\n",
|
529 |
"label = gr.outputs.Label()\n",
|
530 |
"example_images = [ 'cheetah.jpg', 'jaguar.jpg', 'tiger.jpg', 'cougar.jpg', 'lion.jpg', 'african leopard.jpg', 'clouded leopard.jpg', 'snow leopard.jpg' ]\n",
|
|
|
536 |
},
|
537 |
{
|
538 |
"cell_type": "code",
|
539 |
+
"execution_count": 8,
|
540 |
"id": "cab071f9-7c3b-4b35-a0d1-3687731ffce5",
|
541 |
"metadata": {},
|
542 |
+
"outputs": [
|
543 |
+
{
|
544 |
+
"name": "stdout",
|
545 |
+
"output_type": "stream",
|
546 |
+
"text": [
|
547 |
+
"Export successful\n"
|
548 |
+
]
|
549 |
+
}
|
550 |
+
],
|
551 |
"source": [
|
552 |
"import nbdev\n",
|
553 |
"nbdev.export.nb_export('app.ipynb', './')\n",
|
app.py
CHANGED
@@ -31,7 +31,7 @@ def classify_image(img, model_file="resnet-101"):
|
|
31 |
|
32 |
|
33 |
# %% app.ipynb 5
|
34 |
-
image = gr.inputs.Image(
|
35 |
model = gr.inputs.Dropdown(choices=models)
|
36 |
label = gr.outputs.Label()
|
37 |
example_images = [ 'cheetah.jpg', 'jaguar.jpg', 'tiger.jpg', 'cougar.jpg', 'lion.jpg', 'african leopard.jpg', 'clouded leopard.jpg', 'snow leopard.jpg' ]
|
|
|
31 |
|
32 |
|
33 |
# %% app.ipynb 5
|
34 |
+
image = gr.inputs.Image()
|
35 |
model = gr.inputs.Dropdown(choices=models)
|
36 |
label = gr.outputs.Label()
|
37 |
example_images = [ 'cheetah.jpg', 'jaguar.jpg', 'tiger.jpg', 'cougar.jpg', 'lion.jpg', 'african leopard.jpg', 'clouded leopard.jpg', 'snow leopard.jpg' ]
|