Commit 034e67d7 authored by it20118068's avatar it20118068

Update flask backend

parent ba1a76fb
Label,Value
aapasu,a
amathara,a
anawum ankaya,a
athurupasa,a
awasan,a
bagayak,aa
denawa,aa
kalamanakaru,aa
mama,aa
nopaminima,aa
sahakaara kalamanakaru,ae
sama wanna,ae
sthuthi,ae
uyanawa,ae
welawa,ae
yanawa,dh
......@@ -434,7 +434,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 24,
"id": "0352362f",
"metadata": {},
"outputs": [],
......@@ -445,7 +445,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 25,
"id": "42030ff7",
"metadata": {},
"outputs": [],
......@@ -466,7 +466,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 26,
"id": "d0b6ee05",
"metadata": {},
"outputs": [],
......@@ -478,7 +478,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 27,
"id": "17065018-4c5b-44fa-a1b6-a306f2aa8dc7",
"metadata": {},
"outputs": [],
......@@ -489,7 +489,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 28,
"id": "2d1b162e",
"metadata": {},
"outputs": [],
......@@ -504,7 +504,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 29,
"id": "920a3a52",
"metadata": {},
"outputs": [],
......@@ -521,7 +521,7 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 30,
"id": "afebcfa4",
"metadata": {},
"outputs": [],
......@@ -540,7 +540,7 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": 31,
"id": "53dfc484",
"metadata": {},
"outputs": [],
......@@ -589,7 +589,7 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 32,
"id": "c0eb6e3f",
"metadata": {},
"outputs": [],
......@@ -611,7 +611,7 @@
},
{
"cell_type": "code",
"execution_count": 32,
"execution_count": 33,
"id": "d72b74ad",
"metadata": {},
"outputs": [],
......@@ -629,7 +629,7 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": 34,
"id": "c864ad6f",
"metadata": {},
"outputs": [],
......@@ -655,7 +655,7 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": 35,
"id": "a00e8ba6",
"metadata": {},
"outputs": [],
......@@ -669,22 +669,10 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 36,
"id": "01ec60f6",
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'pd' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[2], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;66;03m# class_names = os.listdir(\"SignData/\") #This should replace with a CSV file\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m class_names \u001b[38;5;241m=\u001b[39m \u001b[43mpd\u001b[49m\u001b[38;5;241m.\u001b[39mread_csv(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mSIGN_TO_TEXT_LABELS.csv\u001b[39m\u001b[38;5;124m'\u001b[39m)[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mLabel\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;241m.\u001b[39mstr\u001b[38;5;241m.\u001b[39mlower()\u001b[38;5;241m.\u001b[39munique() \n",
"\u001b[1;31mNameError\u001b[0m: name 'pd' is not defined"
]
}
],
"outputs": [],
"source": [
"# class_names = os.listdir(\"SignData/\") #This should replace with a CSV file\n",
"class_names = pd.read_csv('SIGN_TO_TEXT_LABELS.csv')['Label'].str.lower().unique() "
......@@ -692,22 +680,10 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 37,
"id": "fdc550fe",
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'load_model' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[1], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;66;03m# Load the model\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m loaded_model \u001b[38;5;241m=\u001b[39m \u001b[43mload_model\u001b[49m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mSignToText.h5\u001b[39m\u001b[38;5;124m'\u001b[39m)[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mLabel\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;241m.\u001b[39mstr\u001b[38;5;241m.\u001b[39mlower()\u001b[38;5;241m.\u001b[39munique() \n",
"\u001b[1;31mNameError\u001b[0m: name 'load_model' is not defined"
]
}
],
"outputs": [],
"source": [
"# Load the model\n",
"loaded_model = load_model('SignToText.h5')"
......@@ -715,7 +691,7 @@
},
{
"cell_type": "code",
"execution_count": 36,
"execution_count": 38,
"id": "77f6f0c7",
"metadata": {},
"outputs": [],
......@@ -760,7 +736,7 @@
},
{
"cell_type": "code",
"execution_count": 37,
"execution_count": 39,
"id": "62b03d1c",
"metadata": {},
"outputs": [],
......@@ -784,7 +760,7 @@
},
{
"cell_type": "code",
"execution_count": 38,
"execution_count": 40,
"id": "a8a5345d",
"metadata": {},
"outputs": [],
......@@ -797,7 +773,7 @@
},
{
"cell_type": "code",
"execution_count": 39,
"execution_count": 41,
"id": "916f5057",
"metadata": {},
"outputs": [
......@@ -822,38 +798,70 @@
"name": "stdout",
"output_type": "stream",
"text": [
"1/1 [==============================] - 0s 120ms/step\n"
"1/1 [==============================] - 0s 154ms/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"127.0.0.1 - - [29/Aug/2023 17:36:08] \"POST /api/getTextBySign HTTP/1.1\" 200 -\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"1/1 [==============================] - 0s 27ms/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"127.0.0.1 - - [29/Aug/2023 17:36:12] \"POST /api/getTextBySign HTTP/1.1\" 200 -\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"1/1 [==============================] - 0s 24ms/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"127.0.0.1 - - [29/Aug/2023 17:36:16] \"POST /api/getTextBySign HTTP/1.1\" 200 -\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"1/1 [==============================] - 0s 26ms/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"127.0.0.1 - - [29/Aug/2023 17:36:18] \"POST /api/getTextBySign HTTP/1.1\" 200 -\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"1/1 [==============================] - 0s 31ms/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[2023-08-29 17:31:11,020] ERROR in app: Exception on /api/getTextBySign [POST]\n",
"Traceback (most recent call last):\n",
" File \"C:\\Users\\Shashika Idushan\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\flask\\app.py\", line 2190, in wsgi_app\n",
" response = self.full_dispatch_request()\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Users\\Shashika Idushan\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\flask\\app.py\", line 1486, in full_dispatch_request\n",
" rv = self.handle_user_exception(e)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Users\\Shashika Idushan\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\flask_cors\\extension.py\", line 176, in wrapped_function\n",
" return cors_after_request(app.make_response(f(*args, **kwargs)))\n",
" ^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Users\\Shashika Idushan\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\flask\\app.py\", line 1484, in full_dispatch_request\n",
" rv = self.dispatch_request()\n",
" ^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Users\\Shashika Idushan\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\flask\\app.py\", line 1469, in dispatch_request\n",
" return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Users\\Shashika Idushan\\AppData\\Local\\Temp\\ipykernel_11232\\3668545089.py\", line 3, in getTextBySign\n",
" data = predict_class(request)\n",
" ^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Users\\Shashika Idushan\\AppData\\Local\\Temp\\ipykernel_11232\\1519115528.py\", line 22, in predict_class\n",
" predicted_class = class_names[predicted_class_idx]\n",
" ^^^^^^^^^^^\n",
"NameError: name 'class_names' is not defined\n",
"127.0.0.1 - - [29/Aug/2023 17:31:11] \"POST /api/getTextBySign HTTP/1.1\" 500 -\n"
"127.0.0.1 - - [29/Aug/2023 17:36:24] \"POST /api/getTextBySign HTTP/1.1\" 200 -\n"
]
}
],
......
Label,Value
a,
aa,
ae,
dh,
e,
URL,Label
https://media.discordapp.net/attachments/1070777983108919526/1145999531574575166/a_-_Copy_3.jpeg?width=616&height=662,a
https://media.discordapp.net/attachments/1070777983108919526/1145999531952058398/a_-_Copy_-_Copy.jpeg?width=616&height=662,a
https://media.discordapp.net/attachments/1070777983108919526/1145999532279201803/a_-_Copy_2_-_Copy.jpeg?width=616&height=662,a
https://media.discordapp.net/attachments/1070777983108919526/1145999532962889738/a_-_Copy_2.jpeg?width=616&height=662,a
https://media.discordapp.net/attachments/1070777983108919526/1145999533323595806/a_-_Copy_3_-_Copy.jpeg?width=616&height=662,a
https://media.discordapp.net/attachments/1070777983108919526/1145999860403802202/aa_-_Copy_-_Copy.jpeg?width=597&height=662,aa
https://media.discordapp.net/attachments/1070777983108919526/1145999860693205023/aa_-_Copy_-_Copy_-_Copy.jpeg?width=597&height=662,aa
https://media.discordapp.net/attachments/1070777983108919526/1145999860961656852/aa_-_Copy_-_Copy_2.jpeg?width=597&height=662,aa
https://media.discordapp.net/attachments/1070777983108919526/1145999861267828867/aa_-_Copy_-_Copy_3.jpeg?width=597&height=662,aa
https://media.discordapp.net/attachments/1070777983108919526/1145999861267828867/aa_-_Copy_-_Copy_3.jpeg?width=597&height=662,aa
https://media.discordapp.net/attachments/1070777983108919526/1146000185705648138/ae_-_Copy_2.jpeg?width=743&height=662,ae
https://media.discordapp.net/attachments/1070777983108919526/1146000185982459976/ae_-_Copy_-_Copy_2.jpeg?width=743&height=662,ae
https://media.discordapp.net/attachments/1070777983108919526/1146000186334773308/ae_-_Copy_-_Copy_3.jpeg?width=743&height=662,ae
https://media.discordapp.net/attachments/1070777983108919526/1146000186720669706/ae_-_Copy_-_Copy.jpeg?width=743&height=662,ae
https://media.discordapp.net/attachments/1070777983108919526/1146000186972315699/ae_-_Copy_2_-_Copy.jpeg?width=743&height=662,ae
https://media.discordapp.net/attachments/1070777983108919526/1146000455181275237/dh_-_Copy_2.jpeg?width=725&height=662,dh
https://media.discordapp.net/attachments/1070777983108919526/1146000455453913128/dh_-_Copy_-_Copy_2.jpeg?width=725&height=662,dh
https://media.discordapp.net/attachments/1070777983108919526/1146000455739117668/dh_-_Copy_-_Copy_3.jpeg?width=725&height=662,dh
https://media.discordapp.net/attachments/1070777983108919526/1146000456015949844/dh_-_Copy_-_Copy.jpeg?width=725&height=662,dh
https://media.discordapp.net/attachments/1070777983108919526/1146000456255029318/dh_-_Copy_2_-_Copy.jpeg?width=725&height=662,dh
https://media.discordapp.net/attachments/1070777983108919526/1146000694801858570/e_-_Copy_2_-_Copy.jpeg?width=687&height=662,e
https://media.discordapp.net/attachments/1070777983108919526/1146000695087087636/e_-_Copy_2.jpeg?width=687&height=662,e
https://media.discordapp.net/attachments/1070777983108919526/1146000695439392799/e_-_Copy_-_Copy_2.jpeg?width=687&height=662,e
https://media.discordapp.net/attachments/1070777983108919526/1146000695749787748/e_-_Copy_-_Copy_3.jpeg?width=687&height=662,e
https://media.discordapp.net/attachments/1070777983108919526/1146000696173396018/e_-_Copy_-_Copy.jpeg?width=687&height=662,e
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment