adding example images
Browse files- app.py +6 -2
- example1.webp +0 -0
- example2.webp +0 -0
- example3.webp +0 -0
- is_a_cat.ipynb +86 -10
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
# AUTOGENERATED! DO NOT EDIT! File to edit: is_a_cat.ipynb.
|
2 |
|
3 |
# %% auto 0
|
4 |
-
__all__ = ['learn', 'labels', 'is_cat', 'predict']
|
5 |
|
6 |
# %% is_a_cat.ipynb 1
|
7 |
from fastai.vision.all import *
|
@@ -20,4 +20,8 @@ def predict(img):
|
|
20 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
21 |
|
22 |
# %% is_a_cat.ipynb 4
|
23 |
-
gr.
|
|
|
|
|
|
|
|
|
|
1 |
# AUTOGENERATED! DO NOT EDIT! File to edit: is_a_cat.ipynb.
|
2 |
|
3 |
# %% auto 0
|
4 |
+
__all__ = ['learn', 'labels', 'image', 'examples', 'is_cat', 'predict']
|
5 |
|
6 |
# %% is_a_cat.ipynb 1
|
7 |
from fastai.vision.all import *
|
|
|
20 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
21 |
|
22 |
# %% is_a_cat.ipynb 4
|
23 |
+
image = gr.Image(width=512, height=512)
|
24 |
+
|
25 |
+
examples = ["example1.webp"]
|
26 |
+
|
27 |
+
gr.Interface(fn=predict, inputs="image", examples=examples, outputs="label").launch(share=False)
|
example1.webp
ADDED
![]() |
example2.webp
ADDED
![]() |
example3.webp
ADDED
![]() |
is_a_cat.ipynb
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
-
"execution_count":
|
6 |
"id": "db4fccaf",
|
7 |
"metadata": {},
|
8 |
"outputs": [],
|
@@ -15,7 +15,7 @@
|
|
15 |
},
|
16 |
{
|
17 |
"cell_type": "code",
|
18 |
-
"execution_count":
|
19 |
"id": "7f067622",
|
20 |
"metadata": {},
|
21 |
"outputs": [],
|
@@ -30,7 +30,7 @@
|
|
30 |
},
|
31 |
{
|
32 |
"cell_type": "code",
|
33 |
-
"execution_count":
|
34 |
"id": "2a2f5376",
|
35 |
"metadata": {},
|
36 |
"outputs": [],
|
@@ -42,7 +42,7 @@
|
|
42 |
},
|
43 |
{
|
44 |
"cell_type": "code",
|
45 |
-
"execution_count":
|
46 |
"id": "2ee57395",
|
47 |
"metadata": {},
|
48 |
"outputs": [],
|
@@ -58,7 +58,7 @@
|
|
58 |
},
|
59 |
{
|
60 |
"cell_type": "code",
|
61 |
-
"execution_count":
|
62 |
"id": "7e0abb03",
|
63 |
"metadata": {},
|
64 |
"outputs": [
|
@@ -66,7 +66,7 @@
|
|
66 |
"name": "stdout",
|
67 |
"output_type": "stream",
|
68 |
"text": [
|
69 |
-
"Running on local URL: http://127.0.0.1:
|
70 |
"\n",
|
71 |
"To create a public link, set `share=True` in `launch()`.\n"
|
72 |
]
|
@@ -74,7 +74,7 @@
|
|
74 |
{
|
75 |
"data": {
|
76 |
"text/html": [
|
77 |
-
"<div><iframe src=\"http://127.0.0.1:
|
78 |
],
|
79 |
"text/plain": [
|
80 |
"<IPython.core.display.HTML object>"
|
@@ -87,20 +87,96 @@
|
|
87 |
"data": {
|
88 |
"text/plain": []
|
89 |
},
|
90 |
-
"execution_count":
|
91 |
"metadata": {},
|
92 |
"output_type": "execute_result"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
94 |
],
|
95 |
"source": [
|
96 |
"#|export\n",
|
97 |
"\n",
|
98 |
-
"
|
|
|
|
|
99 |
]
|
100 |
},
|
101 |
{
|
102 |
"cell_type": "code",
|
103 |
-
"execution_count":
|
104 |
"id": "22dc9b3a",
|
105 |
"metadata": {},
|
106 |
"outputs": [
|
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
+
"execution_count": 7,
|
6 |
"id": "db4fccaf",
|
7 |
"metadata": {},
|
8 |
"outputs": [],
|
|
|
15 |
},
|
16 |
{
|
17 |
"cell_type": "code",
|
18 |
+
"execution_count": 8,
|
19 |
"id": "7f067622",
|
20 |
"metadata": {},
|
21 |
"outputs": [],
|
|
|
30 |
},
|
31 |
{
|
32 |
"cell_type": "code",
|
33 |
+
"execution_count": 9,
|
34 |
"id": "2a2f5376",
|
35 |
"metadata": {},
|
36 |
"outputs": [],
|
|
|
42 |
},
|
43 |
{
|
44 |
"cell_type": "code",
|
45 |
+
"execution_count": 10,
|
46 |
"id": "2ee57395",
|
47 |
"metadata": {},
|
48 |
"outputs": [],
|
|
|
58 |
},
|
59 |
{
|
60 |
"cell_type": "code",
|
61 |
+
"execution_count": 17,
|
62 |
"id": "7e0abb03",
|
63 |
"metadata": {},
|
64 |
"outputs": [
|
|
|
66 |
"name": "stdout",
|
67 |
"output_type": "stream",
|
68 |
"text": [
|
69 |
+
"Running on local URL: http://127.0.0.1:7866\n",
|
70 |
"\n",
|
71 |
"To create a public link, set `share=True` in `launch()`.\n"
|
72 |
]
|
|
|
74 |
{
|
75 |
"data": {
|
76 |
"text/html": [
|
77 |
+
"<div><iframe src=\"http://127.0.0.1:7866/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
78 |
],
|
79 |
"text/plain": [
|
80 |
"<IPython.core.display.HTML object>"
|
|
|
87 |
"data": {
|
88 |
"text/plain": []
|
89 |
},
|
90 |
+
"execution_count": 17,
|
91 |
"metadata": {},
|
92 |
"output_type": "execute_result"
|
93 |
+
},
|
94 |
+
{
|
95 |
+
"data": {
|
96 |
+
"text/html": [
|
97 |
+
"\n",
|
98 |
+
"<style>\n",
|
99 |
+
" /* Turns off some styling */\n",
|
100 |
+
" progress {\n",
|
101 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
102 |
+
" border: none;\n",
|
103 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
104 |
+
" background-size: auto;\n",
|
105 |
+
" }\n",
|
106 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
107 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
108 |
+
" }\n",
|
109 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
110 |
+
" background: #F44336;\n",
|
111 |
+
" }\n",
|
112 |
+
"</style>\n"
|
113 |
+
],
|
114 |
+
"text/plain": [
|
115 |
+
"<IPython.core.display.HTML object>"
|
116 |
+
]
|
117 |
+
},
|
118 |
+
"metadata": {},
|
119 |
+
"output_type": "display_data"
|
120 |
+
},
|
121 |
+
{
|
122 |
+
"data": {
|
123 |
+
"text/html": [],
|
124 |
+
"text/plain": [
|
125 |
+
"<IPython.core.display.HTML object>"
|
126 |
+
]
|
127 |
+
},
|
128 |
+
"metadata": {},
|
129 |
+
"output_type": "display_data"
|
130 |
+
},
|
131 |
+
{
|
132 |
+
"data": {
|
133 |
+
"text/html": [
|
134 |
+
"\n",
|
135 |
+
"<style>\n",
|
136 |
+
" /* Turns off some styling */\n",
|
137 |
+
" progress {\n",
|
138 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
139 |
+
" border: none;\n",
|
140 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
141 |
+
" background-size: auto;\n",
|
142 |
+
" }\n",
|
143 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
144 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
145 |
+
" }\n",
|
146 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
147 |
+
" background: #F44336;\n",
|
148 |
+
" }\n",
|
149 |
+
"</style>\n"
|
150 |
+
],
|
151 |
+
"text/plain": [
|
152 |
+
"<IPython.core.display.HTML object>"
|
153 |
+
]
|
154 |
+
},
|
155 |
+
"metadata": {},
|
156 |
+
"output_type": "display_data"
|
157 |
+
},
|
158 |
+
{
|
159 |
+
"data": {
|
160 |
+
"text/html": [],
|
161 |
+
"text/plain": [
|
162 |
+
"<IPython.core.display.HTML object>"
|
163 |
+
]
|
164 |
+
},
|
165 |
+
"metadata": {},
|
166 |
+
"output_type": "display_data"
|
167 |
}
|
168 |
],
|
169 |
"source": [
|
170 |
"#|export\n",
|
171 |
"\n",
|
172 |
+
"examples = [\"example1.webp\",\"example2.webp\",\"example3.webp\"]\n",
|
173 |
+
" \n",
|
174 |
+
"gr.Interface(fn=predict, inputs=\"image\", examples=examples, outputs=\"label\").launch(share=False)"
|
175 |
]
|
176 |
},
|
177 |
{
|
178 |
"cell_type": "code",
|
179 |
+
"execution_count": 18,
|
180 |
"id": "22dc9b3a",
|
181 |
"metadata": {},
|
182 |
"outputs": [
|