Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-029
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2023-029
2023-029
Commits
15ef1c04
Commit
15ef1c04
authored
May 25, 2023
by
janithGamage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: update
Desc : update project
parent
5378cc0a
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
203 additions
and
142 deletions
+203
-142
.vscode/settings.json
.vscode/settings.json
+1
-0
Project/Backend/ML_Models/Learning_Model/API_Calculate_Similarity_Score-2.ipynb
...els/Learning_Model/API_Calculate_Similarity_Score-2.ipynb
+20
-0
Project/Backend/ML_Models/Learning_Model/API_Calculate_Similarity_Score-3.ipynb
...els/Learning_Model/API_Calculate_Similarity_Score-3.ipynb
+101
-35
Project/Backend/ML_Models/Learning_Model/ML_Model_Calculate_Similarity_Score.ipynb
.../Learning_Model/ML_Model_Calculate_Similarity_Score.ipynb
+80
-107
Project/Backend/Server_Python/controllers/curriculum_controller.py
...ackend/Server_Python/controllers/curriculum_controller.py
+0
-0
Project/Backend/Server_Python/main.py
Project/Backend/Server_Python/main.py
+1
-0
No files found.
.vscode/settings.json
View file @
15ef1c04
...
...
@@ -2,6 +2,7 @@
"cSpell.words"
:
[
"Countup"
,
"Janith"
,
"mocq"
,
"SLIIT"
]
}
\ No newline at end of file
Project/Backend/ML_Models/Learning_Model/API_Calculate_Similarity_Score-2.ipynb
View file @
15ef1c04
...
...
@@ -10,6 +10,26 @@
"pip install python-multipart"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "10a7c02f",
"metadata": {},
"outputs": [],
"source": [
"pip install fastapi"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f66f541c",
"metadata": {},
"outputs": [],
"source": [
"pip install uvicorn"
]
},
{
"cell_type": "code",
"execution_count": null,
...
...
Project/Backend/ML_Models/Learning_Model/API_Calculate_Similarity_Score-3.ipynb
View file @
15ef1c04
...
...
@@ -2,9 +2,78 @@
"cells": [
{
"cell_type": "code",
"execution_count":
1
,
"execution_count":
27
,
"id": "3d735e52",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: fastapi in c:\\users\\janithgamage\\.conda\\envs\\test\\lib\\site-packages (0.95.2)\n",
"Requirement already satisfied: starlette<0.28.0,>=0.27.0 in c:\\users\\janithgamage\\.conda\\envs\\test\\lib\\site-packages (from fastapi) (0.27.0)\n",
"Requirement already satisfied: pydantic!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0,>=1.6.2 in c:\\users\\janithgamage\\.conda\\envs\\test\\lib\\site-packages (from fastapi) (1.10.8)\n",
"Requirement already satisfied: typing-extensions>=4.2.0 in c:\\users\\janithgamage\\.conda\\envs\\test\\lib\\site-packages (from pydantic!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0,>=1.6.2->fastapi) (4.3.0)\n",
"Requirement already satisfied: anyio<5,>=3.4.0 in c:\\users\\janithgamage\\.conda\\envs\\test\\lib\\site-packages (from starlette<0.28.0,>=0.27.0->fastapi) (3.5.0)\n",
"Requirement already satisfied: sniffio>=1.1 in c:\\users\\janithgamage\\.conda\\envs\\test\\lib\\site-packages (from anyio<5,>=3.4.0->starlette<0.28.0,>=0.27.0->fastapi) (1.2.0)\n",
"Requirement already satisfied: idna>=2.8 in c:\\users\\janithgamage\\.conda\\envs\\test\\lib\\site-packages (from anyio<5,>=3.4.0->starlette<0.28.0,>=0.27.0->fastapi) (3.4)\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"pip install fastapi"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "8f281d93",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: uvicorn in c:\\users\\janithgamage\\.conda\\envs\\test\\lib\\site-packages (0.22.0)\n",
"Requirement already satisfied: click>=7.0 in c:\\users\\janithgamage\\.conda\\envs\\test\\lib\\site-packages (from uvicorn) (8.1.3)\n",
"Requirement already satisfied: h11>=0.8 in c:\\users\\janithgamage\\.conda\\envs\\test\\lib\\site-packages (from uvicorn) (0.14.0)\n",
"Requirement already satisfied: typing-extensions in c:\\users\\janithgamage\\.conda\\envs\\test\\lib\\site-packages (from uvicorn) (4.3.0)\n",
"Requirement already satisfied: importlib-metadata in c:\\users\\janithgamage\\.conda\\envs\\test\\lib\\site-packages (from click>=7.0->uvicorn) (4.11.3)\n",
"Requirement already satisfied: colorama in c:\\users\\janithgamage\\.conda\\envs\\test\\lib\\site-packages (from click>=7.0->uvicorn) (0.4.6)\n",
"Requirement already satisfied: zipp>=0.5 in c:\\users\\janithgamage\\.conda\\envs\\test\\lib\\site-packages (from importlib-metadata->click>=7.0->uvicorn) (3.11.0)\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"pip install uvicorn"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "97a4a52c",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: python-multipart in c:\\users\\janithgamage\\.conda\\envs\\test\\lib\\site-packages (0.0.6)\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"pip install python-multipart"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "540c9e2f",
"metadata": {},
"outputs": [],
"source": [
"import nest_asyncio\n",
...
...
@@ -17,7 +86,7 @@
},
{
"cell_type": "code",
"execution_count":
2
,
"execution_count":
31
,
"id": "db756418",
"metadata": {},
"outputs": [],
...
...
@@ -36,7 +105,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 3
2
,
"id": "fc83d1b8",
"metadata": {},
"outputs": [],
...
...
@@ -46,7 +115,7 @@
},
{
"cell_type": "code",
"execution_count":
4
,
"execution_count":
33
,
"id": "63dbfc01",
"metadata": {},
"outputs": [],
...
...
@@ -61,7 +130,7 @@
},
{
"cell_type": "code",
"execution_count":
5
,
"execution_count":
34
,
"id": "f7e5cdba",
"metadata": {},
"outputs": [],
...
...
@@ -103,7 +172,7 @@
},
{
"cell_type": "code",
"execution_count":
6
,
"execution_count":
35
,
"id": "d86a9515",
"metadata": {},
"outputs": [
...
...
@@ -118,7 +187,7 @@
")"
]
},
"execution_count":
6
,
"execution_count":
35
,
"metadata": {},
"output_type": "execute_result"
}
...
...
@@ -131,34 +200,37 @@
},
{
"cell_type": "code",
"execution_count":
7
,
"execution_count":
36
,
"id": "4b527135",
"metadata": {},
"outputs": [],
"source": [
"@app.post(\"/predict-similarity\")\n",
"async def predict_similarity(image: UploadFile):\n",
" image_bytes = await image.read()\n",
" img = Image.open(BytesIO(image_bytes))\n",
" img = transform(img).unsqueeze(0)\n",
" output = model(img)\n",
" print(output)\n",
" # Get the maximum predicted probability as the similarity score\n",
" similarity_score = torch.max(output).item() * 100\n",
" similarity_score1 = torch.min(output).item() * 100\n",
" \n",
" return {\"similarity_score\": similarity_score}\n",
"\n",
"# @app.post(\"/predict-similarity\")\n",
"# async def predict_similarity(image: UploadFile):\n",
"# async def predict_similarity(
sign: str,
image: UploadFile):\n",
"# image_bytes = await image.read()\n",
"# img = Image.open(BytesIO(image_bytes))\n",
"# img = transform(img).unsqueeze(0)\n",
"# output = model(img)\n",
"# similarity_score = torch.max(output).item() * 100 # Get the maximum predicted probability as the similarity score\n",
"# return {\"similarity_score\": similarity_score}\n",
"\n",
"\n",
"@app.post(\"/predict-similarity\")\n",
"async def predict_similarity(sign: str, image: UploadFile):\n",
" image_bytes = await image.read()\n",
" img = Image.open(BytesIO(image_bytes))\n",
" img = transform(img).unsqueeze(0)\n",
" output = model(img)\n",
" similarity_score = torch.max(output).item() * 100 # Get the maximum predicted probability as the similarity score\n",
" return {\"sign\": sign, \"similarity_score\": similarity_score}"
"# return {\"sign\": sign, \"similarity_score\": similarity_score}\n"
]
},
{
"cell_type": "code",
"execution_count":
8
,
"execution_count":
37
,
"id": "df08611e",
"metadata": {},
"outputs": [],
...
...
@@ -171,7 +243,7 @@
},
{
"cell_type": "code",
"execution_count":
null
,
"execution_count":
38
,
"id": "84b9601b",
"metadata": {},
"outputs": [
...
...
@@ -179,7 +251,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: Started server process [
36440
]\n",
"INFO: Started server process [
29948
]\n",
"INFO: Waiting for application startup.\n",
"INFO: Application startup complete.\n",
"INFO: Uvicorn running on http://127.0.0.1:8001 (Press CTRL+C to quit)\n"
...
...
@@ -189,17 +261,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
"INFO: 127.0.0.1:63408 - \"POST /predict-similarity HTTP/1.1\" 422 Unprocessable Entity\n",
"INFO: 127.0.0.1:63440 - \"POST /predict-similarity HTTP/1.1\" 422 Unprocessable Entity\n",
"INFO: 127.0.0.1:63461 - \"POST /predict-similarity HTTP/1.1\" 422 Unprocessable Entity\n",
"INFO: 127.0.0.1:63484 - \"POST /predict-similarity HTTP/1.1\" 422 Unprocessable Entity\n",
"INFO: 127.0.0.1:63502 - \"POST /predict-similarity HTTP/1.1\" 422 Unprocessable Entity\n",
"INFO: 127.0.0.1:63517 - \"POST /predict-similarity HTTP/1.1\" 422 Unprocessable Entity\n",
"INFO: 127.0.0.1:63523 - \"POST /predict-similarity HTTP/1.1\" 422 Unprocessable Entity\n",
"INFO: 127.0.0.1:63536 - \"POST /predict-similarity HTTP/1.1\" 422 Unprocessable Entity\n",
"INFO: 127.0.0.1:63536 - \"POST /predict-similarity HTTP/1.1\" 422 Unprocessable Entity\n",
"INFO: 127.0.0.1:63536 - \"POST /predict-similarity HTTP/1.1\" 422 Unprocessable Entity\n",
"INFO: 127.0.0.1:63546 - \"POST /predict-similarity HTTP/1.1\" 422 Unprocessable Entity\n"
"tensor([[2.0707e-08, 1.3095e-06, 4.2269e-09, 3.1405e-08, 7.0333e-13, 1.3519e-07,\n",
" 2.7351e-16, 9.9999e-01, 7.2929e-18, 5.1420e-11, 3.3166e-06, 1.7149e-09,\n",
" 4.6723e-10, 5.4727e-07, 3.0778e-10, 3.3862e-13]],\n",
" grad_fn=<SoftmaxBackward0>)\n",
"INFO: 127.0.0.1:52609 - \"POST /predict-similarity HTTP/1.1\" 200 OK\n"
]
}
],
...
...
@@ -243,7 +309,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.
10.9
"
"version": "3.
7.16
"
}
},
"nbformat": 4,
...
...
Project/Backend/ML_Models/Learning_Model/ML_Model_Calculate_Similarity_Score.ipynb
View file @
15ef1c04
This diff is collapsed.
Click to expand it.
Project/Backend/Server_Python/controllers/curriculum_controller.py
0 → 100644
View file @
15ef1c04
Project/Backend/Server_Python/main.py
View file @
15ef1c04
...
...
@@ -11,6 +11,7 @@ logger = setup_logger()
app
.
include_router
(
users_controller
.
router
)
app
.
include_router
(
translate_controler
.
router
)
# app.include_router(users_controller.router)
# Add cores middleware
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment