Spaces:
Sleeping
Sleeping
imtharun
commited on
Commit
·
90f564e
1
Parent(s):
a550266
fix: bug fixes
Browse files- app.ipynb +119 -26
- app.py +2 -4
- requirements.txt +1 -1
app.ipynb
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
-
"execution_count":
|
6 |
"metadata": {},
|
7 |
"outputs": [],
|
8 |
"source": [
|
@@ -11,7 +11,7 @@
|
|
11 |
},
|
12 |
{
|
13 |
"cell_type": "code",
|
14 |
-
"execution_count":
|
15 |
"metadata": {},
|
16 |
"outputs": [],
|
17 |
"source": [
|
@@ -22,7 +22,7 @@
|
|
22 |
},
|
23 |
{
|
24 |
"cell_type": "code",
|
25 |
-
"execution_count":
|
26 |
"metadata": {},
|
27 |
"outputs": [],
|
28 |
"source": [
|
@@ -60,31 +60,15 @@
|
|
60 |
},
|
61 |
{
|
62 |
"cell_type": "code",
|
63 |
-
"execution_count":
|
64 |
"metadata": {},
|
65 |
"outputs": [
|
66 |
-
{
|
67 |
-
"name": "stderr",
|
68 |
-
"output_type": "stream",
|
69 |
-
"text": [
|
70 |
-
"/tmp/ipykernel_232403/3480190996.py:3: GradioDeprecationWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n",
|
71 |
-
" image = gr.inputs.Image(shape=(192, 192))\n",
|
72 |
-
"/tmp/ipykernel_232403/3480190996.py:3: GradioDeprecationWarning: `optional` parameter is deprecated, and it has no effect\n",
|
73 |
-
" image = gr.inputs.Image(shape=(192, 192))\n",
|
74 |
-
"/tmp/ipykernel_232403/3480190996.py:4: GradioDeprecationWarning: Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components\n",
|
75 |
-
" label = gr.outputs.Label()\n",
|
76 |
-
"/tmp/ipykernel_232403/3480190996.py:4: GradioUnusedKwargWarning: You have unused kwarg parameters in Label, please remove them: {'type': 'auto'}\n",
|
77 |
-
" label = gr.outputs.Label()\n"
|
78 |
-
]
|
79 |
-
},
|
80 |
{
|
81 |
"name": "stdout",
|
82 |
"output_type": "stream",
|
83 |
"text": [
|
84 |
"Running on local URL: http://127.0.0.1:7860\n",
|
85 |
-
"
|
86 |
-
"--------\n",
|
87 |
-
"Running on public URL: https://1ff37f198fe37a32c2.gradio.live\n",
|
88 |
"\n",
|
89 |
"This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n"
|
90 |
]
|
@@ -93,25 +77,134 @@
|
|
93 |
"data": {
|
94 |
"text/plain": []
|
95 |
},
|
96 |
-
"execution_count":
|
97 |
"metadata": {},
|
98 |
"output_type": "execute_result"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
],
|
101 |
"source": [
|
102 |
"#|export\n",
|
103 |
"\n",
|
104 |
-
"image = gr.inputs.Image(shape=(192, 192))\n",
|
105 |
-
"label = gr.outputs.Label()\n",
|
106 |
"examples = ['dog.jpg', 'cat.jpg', 'beagle.jpg']\n",
|
107 |
"\n",
|
108 |
-
"interface = gr.Interface(fn=classify_image, inputs
|
109 |
"interface.launch(inline=False, share=True)"
|
110 |
]
|
111 |
},
|
112 |
{
|
113 |
"cell_type": "code",
|
114 |
-
"execution_count":
|
115 |
"metadata": {},
|
116 |
"outputs": [],
|
117 |
"source": [
|
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
+
"execution_count": 1,
|
6 |
"metadata": {},
|
7 |
"outputs": [],
|
8 |
"source": [
|
|
|
11 |
},
|
12 |
{
|
13 |
"cell_type": "code",
|
14 |
+
"execution_count": 2,
|
15 |
"metadata": {},
|
16 |
"outputs": [],
|
17 |
"source": [
|
|
|
22 |
},
|
23 |
{
|
24 |
"cell_type": "code",
|
25 |
+
"execution_count": 3,
|
26 |
"metadata": {},
|
27 |
"outputs": [],
|
28 |
"source": [
|
|
|
60 |
},
|
61 |
{
|
62 |
"cell_type": "code",
|
63 |
+
"execution_count": null,
|
64 |
"metadata": {},
|
65 |
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
{
|
67 |
"name": "stdout",
|
68 |
"output_type": "stream",
|
69 |
"text": [
|
70 |
"Running on local URL: http://127.0.0.1:7860\n",
|
71 |
+
"Running on public URL: https://5314a740a24f11740c.gradio.live\n",
|
|
|
|
|
72 |
"\n",
|
73 |
"This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n"
|
74 |
]
|
|
|
77 |
"data": {
|
78 |
"text/plain": []
|
79 |
},
|
80 |
+
"execution_count": 7,
|
81 |
"metadata": {},
|
82 |
"output_type": "execute_result"
|
83 |
+
},
|
84 |
+
{
|
85 |
+
"data": {
|
86 |
+
"text/html": [
|
87 |
+
"\n",
|
88 |
+
"<style>\n",
|
89 |
+
" /* Turns off some styling */\n",
|
90 |
+
" progress {\n",
|
91 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
92 |
+
" border: none;\n",
|
93 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
94 |
+
" background-size: auto;\n",
|
95 |
+
" }\n",
|
96 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
97 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
98 |
+
" }\n",
|
99 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
100 |
+
" background: #F44336;\n",
|
101 |
+
" }\n",
|
102 |
+
"</style>\n"
|
103 |
+
],
|
104 |
+
"text/plain": [
|
105 |
+
"<IPython.core.display.HTML object>"
|
106 |
+
]
|
107 |
+
},
|
108 |
+
"metadata": {},
|
109 |
+
"output_type": "display_data"
|
110 |
+
},
|
111 |
+
{
|
112 |
+
"data": {
|
113 |
+
"text/html": [],
|
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 |
+
"\n",
|
125 |
+
"<style>\n",
|
126 |
+
" /* Turns off some styling */\n",
|
127 |
+
" progress {\n",
|
128 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
129 |
+
" border: none;\n",
|
130 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
131 |
+
" background-size: auto;\n",
|
132 |
+
" }\n",
|
133 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
134 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
135 |
+
" }\n",
|
136 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
137 |
+
" background: #F44336;\n",
|
138 |
+
" }\n",
|
139 |
+
"</style>\n"
|
140 |
+
],
|
141 |
+
"text/plain": [
|
142 |
+
"<IPython.core.display.HTML object>"
|
143 |
+
]
|
144 |
+
},
|
145 |
+
"metadata": {},
|
146 |
+
"output_type": "display_data"
|
147 |
+
},
|
148 |
+
{
|
149 |
+
"data": {
|
150 |
+
"text/html": [],
|
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 |
+
"\n",
|
162 |
+
"<style>\n",
|
163 |
+
" /* Turns off some styling */\n",
|
164 |
+
" progress {\n",
|
165 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
166 |
+
" border: none;\n",
|
167 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
168 |
+
" background-size: auto;\n",
|
169 |
+
" }\n",
|
170 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
171 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
172 |
+
" }\n",
|
173 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
174 |
+
" background: #F44336;\n",
|
175 |
+
" }\n",
|
176 |
+
"</style>\n"
|
177 |
+
],
|
178 |
+
"text/plain": [
|
179 |
+
"<IPython.core.display.HTML object>"
|
180 |
+
]
|
181 |
+
},
|
182 |
+
"metadata": {},
|
183 |
+
"output_type": "display_data"
|
184 |
+
},
|
185 |
+
{
|
186 |
+
"data": {
|
187 |
+
"text/html": [],
|
188 |
+
"text/plain": [
|
189 |
+
"<IPython.core.display.HTML object>"
|
190 |
+
]
|
191 |
+
},
|
192 |
+
"metadata": {},
|
193 |
+
"output_type": "display_data"
|
194 |
}
|
195 |
],
|
196 |
"source": [
|
197 |
"#|export\n",
|
198 |
"\n",
|
|
|
|
|
199 |
"examples = ['dog.jpg', 'cat.jpg', 'beagle.jpg']\n",
|
200 |
"\n",
|
201 |
+
"interface = gr.Interface(fn=classify_image, inputs=\"image\", outputs=\"label\", examples=examples)\n",
|
202 |
"interface.launch(inline=False, share=True)"
|
203 |
]
|
204 |
},
|
205 |
{
|
206 |
"cell_type": "code",
|
207 |
+
"execution_count": 8,
|
208 |
"metadata": {},
|
209 |
"outputs": [],
|
210 |
"source": [
|
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
# AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
|
2 |
|
3 |
# %% auto 0
|
4 |
-
__all__ = ['learn', 'categories', '
|
5 |
|
6 |
# %% ../app.ipynb 1
|
7 |
from fastai.vision.all import *
|
@@ -22,9 +22,7 @@ def classify_image(img):
|
|
22 |
return dict(zip(categories, map(float, probs)))
|
23 |
|
24 |
# %% ../app.ipynb 5
|
25 |
-
image = gr.inputs.Image(shape=(192, 192))
|
26 |
-
label = gr.outputs.Label()
|
27 |
examples = ['dog.jpg', 'cat.jpg', 'beagle.jpg']
|
28 |
|
29 |
-
interface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
30 |
interface.launch(inline=False, share=True)
|
|
|
1 |
# AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
|
2 |
|
3 |
# %% auto 0
|
4 |
+
__all__ = ['learn', 'categories', 'examples', 'interface', 'is_cat', 'classify_image']
|
5 |
|
6 |
# %% ../app.ipynb 1
|
7 |
from fastai.vision.all import *
|
|
|
22 |
return dict(zip(categories, map(float, probs)))
|
23 |
|
24 |
# %% ../app.ipynb 5
|
|
|
|
|
25 |
examples = ['dog.jpg', 'cat.jpg', 'beagle.jpg']
|
26 |
|
27 |
+
interface = gr.Interface(fn=classify_image, inputs="image", outputs="label", examples=examples)
|
28 |
interface.launch(inline=False, share=True)
|
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
fastai
|
2 |
-
gradio
|
|
|
1 |
fastai
|
2 |
+
gradio
|