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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"nbformat": 4,
|
3 |
+
"nbformat_minor": 0,
|
4 |
+
"metadata": {
|
5 |
+
"colab": {
|
6 |
+
"provenance": []
|
7 |
+
},
|
8 |
+
"kernelspec": {
|
9 |
+
"name": "python3",
|
10 |
+
"display_name": "Python 3"
|
11 |
+
},
|
12 |
+
"language_info": {
|
13 |
+
"name": "python"
|
14 |
+
}
|
15 |
+
},
|
16 |
+
"cells": [
|
17 |
+
{
|
18 |
+
"cell_type": "code",
|
19 |
+
"source": [
|
20 |
+
"from google.colab import drive\n",
|
21 |
+
"drive.mount('/content/drive')"
|
22 |
+
],
|
23 |
+
"metadata": {
|
24 |
+
"colab": {
|
25 |
+
"base_uri": "https://localhost:8080/"
|
26 |
+
},
|
27 |
+
"id": "VHha5UmeC-9y",
|
28 |
+
"outputId": "5545c9d6-174c-450a-ade6-9c6bc21b5696"
|
29 |
+
},
|
30 |
+
"execution_count": 57,
|
31 |
+
"outputs": [
|
32 |
+
{
|
33 |
+
"output_type": "stream",
|
34 |
+
"name": "stdout",
|
35 |
+
"text": [
|
36 |
+
"Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n"
|
37 |
+
]
|
38 |
+
}
|
39 |
+
]
|
40 |
+
},
|
41 |
+
{
|
42 |
+
"cell_type": "code",
|
43 |
+
"source": [
|
44 |
+
"%cd /content/drive/MyDrive/Fruit_Recognizer"
|
45 |
+
],
|
46 |
+
"metadata": {
|
47 |
+
"colab": {
|
48 |
+
"base_uri": "https://localhost:8080/"
|
49 |
+
},
|
50 |
+
"id": "A9WRi6HVDDuY",
|
51 |
+
"outputId": "4c216d21-4ebf-485f-ea3f-8dc21353831c"
|
52 |
+
},
|
53 |
+
"execution_count": 58,
|
54 |
+
"outputs": [
|
55 |
+
{
|
56 |
+
"output_type": "stream",
|
57 |
+
"name": "stdout",
|
58 |
+
"text": [
|
59 |
+
"/content/drive/MyDrive/Fruit_Recognizer\n"
|
60 |
+
]
|
61 |
+
}
|
62 |
+
]
|
63 |
+
},
|
64 |
+
{
|
65 |
+
"cell_type": "code",
|
66 |
+
"execution_count": 59,
|
67 |
+
"metadata": {
|
68 |
+
"id": "SWpRA6v7QI_R"
|
69 |
+
},
|
70 |
+
"outputs": [],
|
71 |
+
"source": [
|
72 |
+
"!pip install -Uqq fastai gradio nbdev"
|
73 |
+
]
|
74 |
+
},
|
75 |
+
{
|
76 |
+
"cell_type": "code",
|
77 |
+
"source": [
|
78 |
+
"from fastai.vision.all import *\n",
|
79 |
+
"from fastai.vision.all import load_learner\n",
|
80 |
+
"import gradio as gr"
|
81 |
+
],
|
82 |
+
"metadata": {
|
83 |
+
"id": "OpUS3z3MQgZ0"
|
84 |
+
},
|
85 |
+
"execution_count": 60,
|
86 |
+
"outputs": []
|
87 |
+
},
|
88 |
+
{
|
89 |
+
"cell_type": "code",
|
90 |
+
"source": [
|
91 |
+
"model=load_learner(\"models/fruit_model_v6.pkl\")"
|
92 |
+
],
|
93 |
+
"metadata": {
|
94 |
+
"id": "7J-MaltBP0_f"
|
95 |
+
},
|
96 |
+
"execution_count": 61,
|
97 |
+
"outputs": []
|
98 |
+
},
|
99 |
+
{
|
100 |
+
"cell_type": "code",
|
101 |
+
"source": [
|
102 |
+
"fruit_labels = ('Apple', 'Apricot', 'Avocado',\n",
|
103 |
+
" 'Banana', 'Blueberry',\n",
|
104 |
+
" 'Carambola', 'Cherry', 'Fig',\n",
|
105 |
+
" 'Grape', 'Kiwi', 'Lemon',\n",
|
106 |
+
" 'Lychee', 'Mango',\n",
|
107 |
+
" 'Orange', 'Papaya',\n",
|
108 |
+
" 'Pear', 'Pineapple',\n",
|
109 |
+
" 'Raspberry', 'Strawberry', 'Watermelon')\n",
|
110 |
+
"\n",
|
111 |
+
"\n",
|
112 |
+
"def recognize_image(image):\n",
|
113 |
+
" pred, idx, probs = model.predict(image)\n",
|
114 |
+
" print(pred)\n",
|
115 |
+
" return dict(zip(fruit_labels, map(float, probs)))"
|
116 |
+
],
|
117 |
+
"metadata": {
|
118 |
+
"id": "lVtVhZtzQgc3"
|
119 |
+
},
|
120 |
+
"execution_count": 62,
|
121 |
+
"outputs": []
|
122 |
+
},
|
123 |
+
{
|
124 |
+
"cell_type": "code",
|
125 |
+
"source": [
|
126 |
+
"img = PILImage.create(f'test_images/test_0.jpg')\n",
|
127 |
+
"img.thumbnail((192,192))\n",
|
128 |
+
"img"
|
129 |
+
],
|
130 |
+
"metadata": {
|
131 |
+
"id": "TqVA9jzPQgfy",
|
132 |
+
"colab": {
|
133 |
+
"base_uri": "https://localhost:8080/",
|
134 |
+
"height": 145
|
135 |
+
},
|
136 |
+
"outputId": "f058714e-afb7-4875-e421-41da25112aeb"
|
137 |
+
},
|
138 |
+
"execution_count": 63,
|
139 |
+
"outputs": [
|
140 |
+
{
|
141 |
+
"output_type": "execute_result",
|
142 |
+
"data": {
|
143 |
+
"text/plain": [
|
144 |
+
"PILImage mode=RGB size=192x128"
|
145 |
+
],
|
146 |
+
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAMAAAACACAIAAADS5vE8AAAx/UlEQVR4nO29ebRlV30e+H2/vc+99716VaWqkoSExDwJMZhBtgHjhJAEG690285gO7HTiR3cHa847fS0utvLq9Mkqzt2VkjsrDjtYTlpxzbdThyI3R7SgI2dOEBjEBgBAoFAUIBKKtX06r07nLP37+s/9j7n3ldI4lW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rJhuTMBqPRuMQm6YZxWYcm3EIMcQmBAshGu0pEYY9ZUzYI4l77vm6nD1nTzmn3LU5danrcpqnru26tmvnXVp0iy618y51ObU5peyeUk7Zc84pZ88pp9R27rnNqcvJ5Umeyzw5V82VWGnPtgZlzAstIsZocRwai70ECw1DDE1smhibZtRMmmbcNOPRZGM0mUzGGzGOQhxbiCHEEIIFCxZCiCTJUIK8K9x+4SoAUJE+n5DdXaq+dvYMdTln5ewpFWyl3ObsnjrPqeQt+1RClitX16rfihfg1BdqKVk9szQzEsbSY2urAgtmZhbMQgjRCjZCoDUhxNjEEBqzEPpPlsKU8oBXHt38KHKVAGivrCadeg5H3o+1cJf3zQy1GKcmx6WVEE81U1peRO8mrzjafaV9nbBR2tpqR3NfCleelwl2BW5cvmW0YYjWsMGnmFyVAIIeYeqx1GfJl3XKwyCPfh7P6vGokd+eCdf9O/14K2BZ98g+vuvnDVmvtPrEf+Gf+ozHUxAxF8jVCaDHVZa00Fcl2q4CQFysPCWjsCdYLrjGVvpAhlcu/OS1g6S1BlrLZclTyeFfyxUoawCt5bJkDaC1XJasAbSWy5I1gNZyWbIG0FouS9YAWstlyRpAa7ks+f8B9bMgpdvIBPEAAAAASUVORK5CYII=\n"
|
147 |
+
},
|
148 |
+
"metadata": {},
|
149 |
+
"execution_count": 63
|
150 |
+
}
|
151 |
+
]
|
152 |
+
},
|
153 |
+
{
|
154 |
+
"cell_type": "code",
|
155 |
+
"source": [
|
156 |
+
"recognize_image(img)"
|
157 |
+
],
|
158 |
+
"metadata": {
|
159 |
+
"id": "PKU2JFPlQgi2",
|
160 |
+
"colab": {
|
161 |
+
"base_uri": "https://localhost:8080/",
|
162 |
+
"height": 436
|
163 |
+
},
|
164 |
+
"outputId": "a30655cb-1b6b-4953-e423-3625d67f60db"
|
165 |
+
},
|
166 |
+
"execution_count": 64,
|
167 |
+
"outputs": [
|
168 |
+
{
|
169 |
+
"output_type": "stream",
|
170 |
+
"name": "stderr",
|
171 |
+
"text": [
|
172 |
+
"/usr/local/lib/python3.10/dist-packages/fastai/torch_core.py:263: UserWarning: 'has_mps' is deprecated, please use 'torch.backends.mps.is_built()'\n",
|
173 |
+
" return getattr(torch, 'has_mps', False)\n"
|
174 |
+
]
|
175 |
+
},
|
176 |
+
{
|
177 |
+
"output_type": "display_data",
|
178 |
+
"data": {
|
179 |
+
"text/plain": [
|
180 |
+
"<IPython.core.display.HTML object>"
|
181 |
+
],
|
182 |
+
"text/html": [
|
183 |
+
"\n",
|
184 |
+
"<style>\n",
|
185 |
+
" /* Turns off some styling */\n",
|
186 |
+
" progress {\n",
|
187 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
188 |
+
" border: none;\n",
|
189 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
190 |
+
" background-size: auto;\n",
|
191 |
+
" }\n",
|
192 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
193 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
194 |
+
" }\n",
|
195 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
196 |
+
" background: #F44336;\n",
|
197 |
+
" }\n",
|
198 |
+
"</style>\n"
|
199 |
+
]
|
200 |
+
},
|
201 |
+
"metadata": {}
|
202 |
+
},
|
203 |
+
{
|
204 |
+
"output_type": "display_data",
|
205 |
+
"data": {
|
206 |
+
"text/plain": [
|
207 |
+
"<IPython.core.display.HTML object>"
|
208 |
+
],
|
209 |
+
"text/html": []
|
210 |
+
},
|
211 |
+
"metadata": {}
|
212 |
+
},
|
213 |
+
{
|
214 |
+
"output_type": "stream",
|
215 |
+
"name": "stdout",
|
216 |
+
"text": [
|
217 |
+
"Banana\n"
|
218 |
+
]
|
219 |
+
},
|
220 |
+
{
|
221 |
+
"output_type": "execute_result",
|
222 |
+
"data": {
|
223 |
+
"text/plain": [
|
224 |
+
"{'Apple': 5.5752518157703435e-09,\n",
|
225 |
+
" 'Apricot': 2.5855018126463847e-10,\n",
|
226 |
+
" 'Avocado': 4.064226999389575e-08,\n",
|
227 |
+
" 'Banana': 0.9999983310699463,\n",
|
228 |
+
" 'Blueberry': 5.352696064164775e-09,\n",
|
229 |
+
" 'Carambola': 1.3467055737237388e-07,\n",
|
230 |
+
" 'Cherry': 7.743841479168623e-08,\n",
|
231 |
+
" 'Fig': 1.3441150770177046e-07,\n",
|
232 |
+
" 'Grape': 1.305619701241767e-08,\n",
|
233 |
+
" 'Kiwi': 1.0617771550869293e-08,\n",
|
234 |
+
" 'Lemon': 7.528898890996061e-07,\n",
|
235 |
+
" 'Lychee': 1.645614133849449e-08,\n",
|
236 |
+
" 'Mango': 7.693946457720813e-08,\n",
|
237 |
+
" 'Orange': 2.524078865917545e-07,\n",
|
238 |
+
" 'Papaya': 5.074594255916054e-08,\n",
|
239 |
+
" 'Pear': 1.430123717227616e-07,\n",
|
240 |
+
" 'Pineapple': 9.21994214309052e-08,\n",
|
241 |
+
" 'Raspberry': 8.419928754221928e-09,\n",
|
242 |
+
" 'Strawberry': 2.021719680556089e-09,\n",
|
243 |
+
" 'Watermelon': 1.9477317536598093e-09}"
|
244 |
+
]
|
245 |
+
},
|
246 |
+
"metadata": {},
|
247 |
+
"execution_count": 64
|
248 |
+
}
|
249 |
+
]
|
250 |
+
},
|
251 |
+
{
|
252 |
+
"cell_type": "code",
|
253 |
+
"source": [
|
254 |
+
"import gradio as gr\n",
|
255 |
+
"\n",
|
256 |
+
"image = gr.Image()\n",
|
257 |
+
"label = gr.Label()\n",
|
258 |
+
"examples = [\n",
|
259 |
+
" 'test_images/test_0.jpg',\n",
|
260 |
+
" 'test_images/test_1.jpg',\n",
|
261 |
+
" 'test_images/test_2.jpg',\n",
|
262 |
+
" 'test_images/test_4.jpeg'\n",
|
263 |
+
"]\n",
|
264 |
+
"\n",
|
265 |
+
"iface = gr.Interface(fn=recognize_image, inputs=image, outputs=label, examples=examples)\n",
|
266 |
+
"iface.launch(inline=False)\n"
|
267 |
+
],
|
268 |
+
"metadata": {
|
269 |
+
"id": "eWhn_nMJQgls",
|
270 |
+
"colab": {
|
271 |
+
"base_uri": "https://localhost:8080/"
|
272 |
+
},
|
273 |
+
"outputId": "1d509c26-6b0a-4951-fb34-76a4e04add98"
|
274 |
+
},
|
275 |
+
"execution_count": 65,
|
276 |
+
"outputs": [
|
277 |
+
{
|
278 |
+
"output_type": "stream",
|
279 |
+
"name": "stdout",
|
280 |
+
"text": [
|
281 |
+
"Setting queue=True in a Colab notebook requires sharing enabled. Setting `share=True` (you can turn this off by setting `share=False` in `launch()` explicitly).\n",
|
282 |
+
"\n",
|
283 |
+
"Colab notebook detected. To show errors in colab notebook, set debug=True in launch()\n",
|
284 |
+
"Running on public URL: https://64643211b6c5ebf0bf.gradio.live\n",
|
285 |
+
"\n",
|
286 |
+
"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"
|
287 |
+
]
|
288 |
+
},
|
289 |
+
{
|
290 |
+
"output_type": "execute_result",
|
291 |
+
"data": {
|
292 |
+
"text/plain": []
|
293 |
+
},
|
294 |
+
"metadata": {},
|
295 |
+
"execution_count": 65
|
296 |
+
}
|
297 |
+
]
|
298 |
+
},
|
299 |
+
{
|
300 |
+
"cell_type": "code",
|
301 |
+
"source": [
|
302 |
+
"\n"
|
303 |
+
],
|
304 |
+
"metadata": {
|
305 |
+
"id": "RUkeg4_2jND8"
|
306 |
+
},
|
307 |
+
"execution_count": 65,
|
308 |
+
"outputs": []
|
309 |
+
},
|
310 |
+
{
|
311 |
+
"cell_type": "code",
|
312 |
+
"source": [],
|
313 |
+
"metadata": {
|
314 |
+
"id": "JqItGOrkQgo2"
|
315 |
+
},
|
316 |
+
"execution_count": 65,
|
317 |
+
"outputs": []
|
318 |
+
}
|
319 |
+
]
|
320 |
+
}
|
README.md
CHANGED
@@ -1,12 +1,13 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
-
sdk_version:
|
8 |
app_file: app.py
|
9 |
pinned: false
|
|
|
10 |
---
|
11 |
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: Fruit Recognizer
|
3 |
+
emoji: 🐨
|
4 |
+
colorFrom: yellow
|
5 |
+
colorTo: pink
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 3.16.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
+
license: apache-2.0
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
from fastai.vision.all import load_learner
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
fruit_labels = ('Apple', 'Apricot', 'Avocado',
|
6 |
+
'Banana', 'Blueberry',
|
7 |
+
'Carambola', 'Cherry', 'Fig',
|
8 |
+
'Grape', 'Kiwi', 'Lemon',
|
9 |
+
'Lychee', 'Mango',
|
10 |
+
'Orange', 'Papaya',
|
11 |
+
'Pear', 'Pineapple',
|
12 |
+
'Raspberry', 'Strawberry', 'Watermelon')
|
13 |
+
|
14 |
+
model=load_learner("model/fruit_model_v6.pkl")
|
15 |
+
|
16 |
+
def recognize_image(image):
|
17 |
+
pred, idx, probs = model.predict(image)
|
18 |
+
print(pred)
|
19 |
+
return dict(zip(fruit_labels, map(float, probs)))
|
20 |
+
|
21 |
+
|
22 |
+
image = gr.inputs.Image(shape=(192,192))
|
23 |
+
label = gr.outputs.Label(num_top_classes=5)
|
24 |
+
examples = [
|
25 |
+
'test_images/test_0.jpg',
|
26 |
+
'test_images/test_1.jpg',
|
27 |
+
'test_images/test_2.jpg',
|
28 |
+
'test_images/test_4.jpeg'
|
29 |
+
]
|
30 |
+
|
31 |
+
iface = gr.Interface(fn=recognize_image, inputs=image, outputs=label, examples=examples)
|
32 |
+
iface.launch(inline=False,share=True)
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
Gradio==3.16.0
|
2 |
+
Fastai==2.7.13
|