Samuel Rico commited on
Commit
d5e8bf2
·
1 Parent(s): 811533a
.ipynb_checkpoints/Untitled-checkpoint.ipynb ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [],
3
+ "metadata": {},
4
+ "nbformat": 4,
5
+ "nbformat_minor": 5
6
+ }
.ipynb_checkpoints/pruebaGradio-checkpoint.ipynb ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "33bf520f",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": []
10
+ }
11
+ ],
12
+ "metadata": {
13
+ "kernelspec": {
14
+ "display_name": "Python 3 (ipykernel)",
15
+ "language": "python",
16
+ "name": "python3"
17
+ },
18
+ "language_info": {
19
+ "codemirror_mode": {
20
+ "name": "ipython",
21
+ "version": 3
22
+ },
23
+ "file_extension": ".py",
24
+ "mimetype": "text/x-python",
25
+ "name": "python",
26
+ "nbconvert_exporter": "python",
27
+ "pygments_lexer": "ipython3",
28
+ "version": "3.9.13"
29
+ }
30
+ },
31
+ "nbformat": 4,
32
+ "nbformat_minor": 5
33
+ }
BreedModel.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:079813e941e2ea09823f10dd5df2d50b94d2ca9e367d1b6bc93edb9c36d7f470
3
+ size 46974485
Dominique/OIP.jpeg ADDED
Dominique/db1c396e818a0b121755d6bee3931166.jpg ADDED
Hasso/IMG-20230728-WA0004.jpg ADDED
Hasso/IMG-20230728-WA0005.jpg ADDED
Hasso/IMG-20230728-WA0006.jpg ADDED
Hasso/IMG-20230728-WA0007.jpg ADDED
Hasso/IMG-20230728-WA0008.jpg ADDED
Hasso/IMG-20230728-WA0009.jpg ADDED
Hasso/IMG-20230728-WA0010.jpg ADDED
Hasso/IMG-20230728-WA0011.jpg ADDED
Hasso/IMG-20230728-WA0012.jpg ADDED
Hasso/IMG-20230728-WA0013.jpg ADDED
Hasso/IMG-20230728-WA0014.jpg ADDED
Hasso/IMG-20230728-WA0015.jpg ADDED
Hasso/IMG-20230728-WA0016.jpg ADDED
Hasso/IMG-20230728-WA0017.jpg ADDED
Hasso/IMG-20230728-WA0018.jpg ADDED
Hasso/IMG-20230728-WA0019.jpg ADDED
Untitled.ipynb ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [],
3
+ "metadata": {},
4
+ "nbformat": 4,
5
+ "nbformat_minor": 5
6
+ }
app.py CHANGED
@@ -5,7 +5,7 @@ from fastai.vision.all import *
5
  import gradio as gr
6
  temp = pathlib.PosixPath
7
  pathlib.PosixPath = pathlib.WindowsPath
8
- learn = load_learner('../BreedModel.pkl')
9
  categories = ('Bull Terrier', 'Dobermann', 'German Shepherd')
10
 
11
  def classify_image(img):
 
5
  import gradio as gr
6
  temp = pathlib.PosixPath
7
  pathlib.PosixPath = pathlib.WindowsPath
8
+ learn = load_learner('BreedModel.pkl')
9
  categories = ('Bull Terrier', 'Dobermann', 'German Shepherd')
10
 
11
  def classify_image(img):
flagged/img/16a1d17438291679752b575f49b9a02f96935d5a/tmpoq0k8n_e.jpg ADDED
flagged/log.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ img,output,flag,username,timestamp
2
+ ,C:\Users\57310\OneDrive - Universidad EAFIT\Escritorio\Cursos\fastAI\prueba1\flagged\output\tmpa_u7z4aw.json,,,2023-07-28 22:18:04.637407
3
+ ,C:\Users\57310\OneDrive - Universidad EAFIT\Escritorio\Cursos\fastAI\prueba1\flagged\output\tmp6u43x9it.json,,,2023-07-28 22:18:10.269792
4
+ C:\Users\57310\OneDrive - Universidad EAFIT\Escritorio\Cursos\fastAI\prueba1\flagged\img\16a1d17438291679752b575f49b9a02f96935d5a\tmpoq0k8n_e.jpg,C:\Users\57310\OneDrive - Universidad EAFIT\Escritorio\Cursos\fastAI\prueba1\flagged\output\tmp3_tz5nel.json,,,2023-07-28 22:19:00.261891
flagged/output/tmp3_tz5nel.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"label": "Dobermann", "confidences": [{"label": "Dobermann", "confidence": 0.5252376794815063}, {"label": "Bull Terrier", "confidence": 0.4211626648902893}, {"label": "German Shepherd", "confidence": 0.05359971523284912}]}
flagged/output/tmp6u43x9it.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
flagged/output/tmpa_u7z4aw.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
pruebaGradio.ipynb ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "c36629cb",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": []
10
+ },
11
+ {
12
+ "cell_type": "code",
13
+ "execution_count": 4,
14
+ "id": "b1b65d61",
15
+ "metadata": {},
16
+ "outputs": [],
17
+ "source": [
18
+ "import pathlib\n",
19
+ "from fastai.vision.all import *\n",
20
+ "temp = pathlib.PosixPath\n",
21
+ "pathlib.PosixPath = pathlib.WindowsPath\n",
22
+ "learn = load_learner('BreedModel.pkl')"
23
+ ]
24
+ },
25
+ {
26
+ "cell_type": "code",
27
+ "execution_count": 5,
28
+ "id": "081c71b1",
29
+ "metadata": {},
30
+ "outputs": [],
31
+ "source": [
32
+ "categories = learn.dls.vocab\n",
33
+ "def classify_image(img):\n",
34
+ " pred,pred_idx,probs = learn.predict(img)\n",
35
+ " return {categories[i]: float(probs[i]) for i in range(len(categories))}"
36
+ ]
37
+ },
38
+ {
39
+ "cell_type": "code",
40
+ "execution_count": null,
41
+ "id": "41de9255",
42
+ "metadata": {},
43
+ "outputs": [
44
+ {
45
+ "name": "stderr",
46
+ "output_type": "stream",
47
+ "text": [
48
+ "C:\\Users\\57310\\AppData\\Local\\Temp/ipykernel_26988/2842739511.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",
49
+ " gr.Interface(fn=classify_image, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3), examples=examples).launch(share=True)\n",
50
+ "C:\\Users\\57310\\AppData\\Local\\Temp/ipykernel_26988/2842739511.py:3: GradioDeprecationWarning: `optional` parameter is deprecated, and it has no effect\n",
51
+ " gr.Interface(fn=classify_image, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3), examples=examples).launch(share=True)\n",
52
+ "C:\\Users\\57310\\AppData\\Local\\Temp/ipykernel_26988/2842739511.py:3: GradioDeprecationWarning: Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components\n",
53
+ " gr.Interface(fn=classify_image, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3), examples=examples).launch(share=True)\n",
54
+ "C:\\Users\\57310\\AppData\\Local\\Temp/ipykernel_26988/2842739511.py:3: GradioUnusedKwargWarning: You have unused kwarg parameters in Label, please remove them: {'type': 'auto'}\n",
55
+ " gr.Interface(fn=classify_image, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3), examples=examples).launch(share=True)\n"
56
+ ]
57
+ },
58
+ {
59
+ "name": "stdout",
60
+ "output_type": "stream",
61
+ "text": [
62
+ "Running on local URL: http://127.0.0.1:7860\n",
63
+ "Running on public URL: https://0c0b6c90e0e6b4495b.gradio.live\n",
64
+ "\n",
65
+ "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"
66
+ ]
67
+ },
68
+ {
69
+ "data": {
70
+ "text/html": [
71
+ "<div><iframe src=\"https://0c0b6c90e0e6b4495b.gradio.live\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
72
+ ],
73
+ "text/plain": [
74
+ "<IPython.core.display.HTML object>"
75
+ ]
76
+ },
77
+ "metadata": {},
78
+ "output_type": "display_data"
79
+ },
80
+ {
81
+ "data": {
82
+ "text/plain": []
83
+ },
84
+ "execution_count": 6,
85
+ "metadata": {},
86
+ "output_type": "execute_result"
87
+ },
88
+ {
89
+ "data": {
90
+ "text/html": [
91
+ "\n",
92
+ "<style>\n",
93
+ " /* Turns off some styling */\n",
94
+ " progress {\n",
95
+ " /* gets rid of default border in Firefox and Opera. */\n",
96
+ " border: none;\n",
97
+ " /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
98
+ " background-size: auto;\n",
99
+ " }\n",
100
+ " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
101
+ " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
102
+ " }\n",
103
+ " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
104
+ " background: #F44336;\n",
105
+ " }\n",
106
+ "</style>\n"
107
+ ],
108
+ "text/plain": [
109
+ "<IPython.core.display.HTML object>"
110
+ ]
111
+ },
112
+ "metadata": {},
113
+ "output_type": "display_data"
114
+ },
115
+ {
116
+ "data": {
117
+ "text/html": [],
118
+ "text/plain": [
119
+ "<IPython.core.display.HTML object>"
120
+ ]
121
+ },
122
+ "metadata": {},
123
+ "output_type": "display_data"
124
+ },
125
+ {
126
+ "data": {
127
+ "text/html": [
128
+ "\n",
129
+ "<style>\n",
130
+ " /* Turns off some styling */\n",
131
+ " progress {\n",
132
+ " /* gets rid of default border in Firefox and Opera. */\n",
133
+ " border: none;\n",
134
+ " /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
135
+ " background-size: auto;\n",
136
+ " }\n",
137
+ " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
138
+ " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
139
+ " }\n",
140
+ " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
141
+ " background: #F44336;\n",
142
+ " }\n",
143
+ "</style>\n"
144
+ ],
145
+ "text/plain": [
146
+ "<IPython.core.display.HTML object>"
147
+ ]
148
+ },
149
+ "metadata": {},
150
+ "output_type": "display_data"
151
+ },
152
+ {
153
+ "data": {
154
+ "text/html": [],
155
+ "text/plain": [
156
+ "<IPython.core.display.HTML object>"
157
+ ]
158
+ },
159
+ "metadata": {},
160
+ "output_type": "display_data"
161
+ },
162
+ {
163
+ "data": {
164
+ "text/html": [
165
+ "\n",
166
+ "<style>\n",
167
+ " /* Turns off some styling */\n",
168
+ " progress {\n",
169
+ " /* gets rid of default border in Firefox and Opera. */\n",
170
+ " border: none;\n",
171
+ " /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
172
+ " background-size: auto;\n",
173
+ " }\n",
174
+ " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
175
+ " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
176
+ " }\n",
177
+ " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
178
+ " background: #F44336;\n",
179
+ " }\n",
180
+ "</style>\n"
181
+ ],
182
+ "text/plain": [
183
+ "<IPython.core.display.HTML object>"
184
+ ]
185
+ },
186
+ "metadata": {},
187
+ "output_type": "display_data"
188
+ },
189
+ {
190
+ "data": {
191
+ "text/html": [],
192
+ "text/plain": [
193
+ "<IPython.core.display.HTML object>"
194
+ ]
195
+ },
196
+ "metadata": {},
197
+ "output_type": "display_data"
198
+ },
199
+ {
200
+ "data": {
201
+ "text/html": [
202
+ "\n",
203
+ "<style>\n",
204
+ " /* Turns off some styling */\n",
205
+ " progress {\n",
206
+ " /* gets rid of default border in Firefox and Opera. */\n",
207
+ " border: none;\n",
208
+ " /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
209
+ " background-size: auto;\n",
210
+ " }\n",
211
+ " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
212
+ " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
213
+ " }\n",
214
+ " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
215
+ " background: #F44336;\n",
216
+ " }\n",
217
+ "</style>\n"
218
+ ],
219
+ "text/plain": [
220
+ "<IPython.core.display.HTML object>"
221
+ ]
222
+ },
223
+ "metadata": {},
224
+ "output_type": "display_data"
225
+ },
226
+ {
227
+ "data": {
228
+ "text/html": [],
229
+ "text/plain": [
230
+ "<IPython.core.display.HTML object>"
231
+ ]
232
+ },
233
+ "metadata": {},
234
+ "output_type": "display_data"
235
+ },
236
+ {
237
+ "data": {
238
+ "text/html": [
239
+ "\n",
240
+ "<style>\n",
241
+ " /* Turns off some styling */\n",
242
+ " progress {\n",
243
+ " /* gets rid of default border in Firefox and Opera. */\n",
244
+ " border: none;\n",
245
+ " /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
246
+ " background-size: auto;\n",
247
+ " }\n",
248
+ " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
249
+ " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
250
+ " }\n",
251
+ " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
252
+ " background: #F44336;\n",
253
+ " }\n",
254
+ "</style>\n"
255
+ ],
256
+ "text/plain": [
257
+ "<IPython.core.display.HTML object>"
258
+ ]
259
+ },
260
+ "metadata": {},
261
+ "output_type": "display_data"
262
+ },
263
+ {
264
+ "data": {
265
+ "text/html": [],
266
+ "text/plain": [
267
+ "<IPython.core.display.HTML object>"
268
+ ]
269
+ },
270
+ "metadata": {},
271
+ "output_type": "display_data"
272
+ }
273
+ ],
274
+ "source": [
275
+ "import gradio as gr\n",
276
+ "examples = 'Hasso'\n",
277
+ "gr.Interface(fn=classify_image, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3), examples=examples).launch(share=True)"
278
+ ]
279
+ }
280
+ ],
281
+ "metadata": {
282
+ "kernelspec": {
283
+ "display_name": "Python 3 (ipykernel)",
284
+ "language": "python",
285
+ "name": "python3"
286
+ },
287
+ "language_info": {
288
+ "codemirror_mode": {
289
+ "name": "ipython",
290
+ "version": 3
291
+ },
292
+ "file_extension": ".py",
293
+ "mimetype": "text/x-python",
294
+ "name": "python",
295
+ "nbconvert_exporter": "python",
296
+ "pygments_lexer": "ipython3",
297
+ "version": "3.9.13"
298
+ }
299
+ },
300
+ "nbformat": 4,
301
+ "nbformat_minor": 5
302
+ }