Skip to content

Commit dabc7e9

Browse files
committed
Created using Colaboratory
1 parent 8ad9f45 commit dabc7e9

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

image_classification_api.ipynb

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"colab": {
66
"name": "image_classification_api.ipynb",
77
"provenance": [],
8-
"authorship_tag": "ABX9TyPfIvL8gBIX/AmhLYjFsMxz",
8+
"authorship_tag": "ABX9TyMhXgOvQyLiMY4uFPYQMak+",
99
"include_colab_link": true
1010
},
1111
"kernelspec": {
@@ -182,18 +182,24 @@
182182
"source": [
183183
"## Receive Post request to classify the image included in its body\n",
184184
"\n",
185-
"Using **fastapi** lib, we create a path to be used in a post request url to call the function named ***classifyimage***, in the post request body, there should be a json object that has an image in 64-base format.\n",
186-
"request body ex.:\n",
185+
"Using **`fastapi`** lib, we create a path to be used in a post request url to call the function named **`classifyimage`**, in the post request body, there should be a json object that has an image in 64-base format.\n",
186+
"* request body ex.:\n",
187187
"```\n",
188188
"{\n",
189189
" file:\"64-base encoded image\"\n",
190190
"}\n",
191191
"```\n",
192192
"\n",
193-
"in ***classifyimage*** function:\n",
193+
"in **`classifyimage`** function:\n",
194+
"\n",
195+
"1. Convert the 64-base encoded image to **`png`** file and save the generated image in \"**`imageToSave.png`**\" file.\n",
196+
"2. call **`get_animal_name`** to get the animal name from the image using image recognition model.\n",
197+
"3. replace all white spaces in the animal name with underscore ( **`_`** ).\n",
198+
"4. convert all letters in the animal name to lowercase.\n",
199+
"5. use **`Classify`** class to classify the animal using its name and return **`True`** if it not a wild animal and return **`False`** otherwise\n",
200+
"\n",
201+
"\n",
194202
"\n",
195-
"* Convert the 64-base encoded image to **png** file and save the generated image in \"imageToSave.png\" file\n",
196-
"* call *get_animal_name* to get the animal name from the image using image recognition model\n",
197203
"\n"
198204
]
199205
},
@@ -233,6 +239,17 @@
233239
"execution_count": null,
234240
"outputs": []
235241
},
242+
{
243+
"cell_type": "markdown",
244+
"metadata": {
245+
"id": "g0f-oq5kQeRV"
246+
},
247+
"source": [
248+
"## **Calssify class**\n",
249+
"Using wordnet synsets and hypernyms, this class used to know if the animal_name is belong to **`domestic_animal`**, **`birds`** or **`entity`** using **dfs** algorithm.\n",
250+
"Then if the animal_name belongs to **`domestic_animal`**, **`birds`** then the function returns **`True`**, otherwise returns **`False`**"
251+
]
252+
},
236253
{
237254
"cell_type": "code",
238255
"metadata": {

0 commit comments

Comments
 (0)