Commit 39909344 authored by Gamage B.G.J's avatar Gamage B.G.J

Merge branch 'dev' into 'master'

Dev

See merge request !5
parents b67a974b 57a9efd8
models/*
!models/
DataSet/Sn_sign_language_dataset/
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "f47e929b",
"metadata": {},
"outputs": [],
"source": [
"import nest_asyncio\n",
"import asyncio\n",
"import torch.nn.functional as F\n",
"import torch.nn as nn\n",
"import torchvision.transforms as transforms\n",
"import numpy as np\n",
"import io\n",
"import uvicorn\n",
"from fastapi import FastAPI, UploadFile\n",
"from PIL import Image\n",
"import torch"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "13b1d58b",
"metadata": {},
"outputs": [],
"source": [
"nest_asyncio.apply()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "35f4adc0",
"metadata": {},
"outputs": [],
"source": [
"app = FastAPI()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "a5aba4be",
"metadata": {},
"outputs": [],
"source": [
"transform = transforms.Compose([\n",
" transforms.Resize((300, 300)),\n",
" transforms.Grayscale(num_output_channels=1),\n",
" transforms.ToTensor(),\n",
" transforms.Normalize(mean=(0.5), std=(0.5))\n",
"])"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "11ec2fae",
"metadata": {},
"outputs": [],
"source": [
"class theCNN(nn.Module):\n",
" def __init__(self):\n",
" super(theCNN, self).__init__()\n",
" \n",
" self.conv01 = nn.Conv2d(\n",
" in_channels=1,\n",
" out_channels=10,\n",
" kernel_size=5,\n",
" stride=1,\n",
" padding=1\n",
" )\n",
" \n",
" self.conv02 = nn.Conv2d(\n",
" in_channels=10,\n",
" out_channels=20,\n",
" kernel_size=5,\n",
" stride=1,\n",
" padding=1\n",
" )\n",
" \n",
" expectedSize = int(np.floor((73 + 2 * 0 - 1) / 1) + 1)\n",
" expectedSize = 20 * int(expectedSize ** 2)\n",
" \n",
" self.fc01 = nn.Linear(expectedSize, 50)\n",
" self.output = nn.Linear(50, 16)\n",
"\n",
" def forward(self, x):\n",
" x = F.relu(F.max_pool2d(self.conv01(x), 2))\n",
" x = F.relu(F.max_pool2d(self.conv02(x), 2))\n",
" nUnits = x.shape.numel() / x.shape[0]\n",
" x = x.view(-1, int(nUnits))\n",
" x = F.relu(self.fc01(x))\n",
" return torch.softmax(self.output(x), axis=1)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "353a4725",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"theCNN(\n",
" (conv01): Conv2d(1, 10, kernel_size=(5, 5), stride=(1, 1), padding=(1, 1))\n",
" (conv02): Conv2d(10, 20, kernel_size=(5, 5), stride=(1, 1), padding=(1, 1))\n",
" (fc01): Linear(in_features=106580, out_features=50, bias=True)\n",
" (output): Linear(in_features=50, out_features=16, bias=True)\n",
")"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model = theCNN()\n",
"model.load_state_dict(torch.load(\"model.pth\"))\n",
"model.eval()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "bb87b7f0",
"metadata": {},
"outputs": [],
"source": [
"@app.post(\"/score\")\n",
"async def calculate_score(image_file: UploadFile):\n",
" image = Image.open(io.BytesIO(await image_file.read())).convert(\"L\")\n",
" image = transform(image).unsqueeze(0)\n",
"\n",
" with torch.no_grad():\n",
" output = model(image)\n",
"\n",
" probabilities = torch.softmax(output, dim=1)[0]\n",
" predicted_class = torch.argmax(probabilities).item()\n",
"\n",
" # Get the actual number corresponding to the hand sign\n",
" actual_number = get_actual_number_from_image(image)\n",
" \n",
" print(actual_number)\n",
"\n",
" # Compare predicted class with actual number and calculate correctness percentage\n",
" correct = int(predicted_class + 1 == actual_number)\n",
" print(correct)\n",
" correctness_percentage = correct / 1.0 * 100.0\n",
"\n",
" return {\"predicted_class\": predicted_class, \"correctness_percentage\": correctness_percentage}"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "05646e93",
"metadata": {},
"outputs": [],
"source": [
"import cv2\n",
"import numpy as np\n",
"\n",
"def get_actual_number_from_image(image):\n",
" # Convert the image to numpy array\n",
" image_array = np.array(image)\n",
"\n",
" # Apply image processing techniques to detect and recognize digits\n",
" # Example steps: thresholding, contour detection, character segmentation, digit recognition\n",
"\n",
" # Apply thresholding\n",
" _, binary_image = cv2.threshold(image_array, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)\n",
"\n",
" # Find contours\n",
" contours, _ = cv2.findContours(binary_image, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)\n",
"\n",
" # Sort contours based on their x-coordinate\n",
" contours = sorted(contours, key=lambda cnt: cv2.boundingRect(cnt)[0])\n",
"\n",
" # Initialize the recognized digit sequence\n",
" digit_sequence = \"\"\n",
"\n",
" # Iterate over the contours and recognize digits\n",
" for contour in contours:\n",
" # Get the bounding box of the contour\n",
" x, y, w, h = cv2.boundingRect(contour)\n",
"\n",
" # Crop the digit region from the image\n",
" digit_image = binary_image[y:y + h, x:x + w]\n",
"\n",
" # Resize the digit image to a fixed size (e.g., 28x28)\n",
" resized_digit_image = cv2.resize(digit_image, (28, 28))\n",
"\n",
" # Preprocess the resized digit image (e.g., normalize pixel values)\n",
" preprocessed_digit_image = resized_digit_image / 255.0\n",
"\n",
" # Flatten the preprocessed digit image\n",
" flattened_digit_image = preprocessed_digit_image.flatten()\n",
"\n",
" # Pass the flattened digit image to your digit recognition model\n",
" # to get the predicted digit (e.g., using a separate model or the same model you used for training)\n",
"\n",
" # Here, let's assume you have a function `predict_digit` that takes the flattened digit image\n",
" # and returns the predicted digit as an integer\n",
" predicted_digit = predict_digit(flattened_digit_image)\n",
"\n",
" # Add the predicted digit to the digit sequence\n",
" digit_sequence += str(predicted_digit)\n",
"\n",
" # Convert the digit sequence to an integer\n",
" actual_number = int(digit_sequence)\n",
"\n",
" return actual_number\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ee993fc1",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: Started server process [36312]\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"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"5\n",
"0\n",
"INFO: 127.0.0.1:60625 - \"POST /score HTTP/1.1\" 200 OK\n"
]
}
],
"source": [
"if __name__ == \"__main__\":\n",
" loop = asyncio.get_event_loop()\n",
" loop.create_task(uvicorn.run(app, host=\"127.0.0.1\", port=8001))\n",
" loop.run_forever()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "34c5efea",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "c898b57c",
"metadata": {},
"outputs": [],
"source": [
"pip install python-multipart"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "a99b4156",
"metadata": {},
"outputs": [],
"source": [
"import nest_asyncio\n",
"import asyncio\n",
"import torch.nn.functional as F\n",
"\n",
"# Apply the patch\n",
"nest_asyncio.apply()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "01b6e57c",
"metadata": {},
"outputs": [],
"source": [
"from fastapi import FastAPI, UploadFile\n",
"from PIL import Image\n",
"import torch\n",
"import torchvision.transforms as transforms\n",
"import numpy as np\n",
"import io\n",
"import torch.nn as nn\n",
"import asyncio\n",
"import uvicorn "
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "2e561f13",
"metadata": {},
"outputs": [],
"source": [
"app = FastAPI()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "1e9e4208",
"metadata": {},
"outputs": [],
"source": [
"transform = transforms.Compose([\n",
" transforms.Resize((300, 300)),\n",
" transforms.Grayscale(num_output_channels=1),\n",
" transforms.ToTensor(),\n",
" transforms.Normalize(mean=(0.5), std=(0.5))\n",
"])"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "4d86d2b8",
"metadata": {},
"outputs": [],
"source": [
"class theCNN(nn.Module):\n",
" def __init__(self):\n",
" super(theCNN, self).__init__()\n",
" \n",
" self.conv01 = nn.Conv2d(\n",
" in_channels=1,\n",
" out_channels=10,\n",
" kernel_size=5,\n",
" stride=1,\n",
" padding=1\n",
" )\n",
" \n",
" self.conv02 = nn.Conv2d(\n",
" in_channels=10,\n",
" out_channels=20,\n",
" kernel_size=5,\n",
" stride=1,\n",
" padding=1\n",
" )\n",
" \n",
" expectedSize = int(np.floor((73 + 2 * 0 - 1) / 1) + 1)\n",
" expectedSize = 20 * int(expectedSize ** 2)\n",
" \n",
" self.fc01 = nn.Linear(expectedSize, 50)\n",
" self.output = nn.Linear(50, 16)\n",
"\n",
" def forward(self, x):\n",
" x = F.relu(F.max_pool2d(self.conv01(x), 2))\n",
" x = F.relu(F.max_pool2d(self.conv02(x), 2))\n",
" nUnits = x.shape.numel() / x.shape[0]\n",
" x = x.view(-1, int(nUnits))\n",
" x = F.relu(self.fc01(x))\n",
" return torch.softmax(self.output(x), axis=1)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "9379bf73",
"metadata": {},
"outputs": [
{
"ename": "TypeError",
"evalue": "Expected state_dict to be dict-like, got <class '__main__.theCNN'>.",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[6], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m model \u001b[38;5;241m=\u001b[39m theCNN()\n\u001b[1;32m----> 2\u001b[0m \u001b[43mmodel\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mload_state_dict\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtorch\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mload\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmodel1.pth\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 3\u001b[0m model\u001b[38;5;241m.\u001b[39meval()\n",
"File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python310\\site-packages\\torch\\nn\\modules\\module.py:1994\u001b[0m, in \u001b[0;36mModule.load_state_dict\u001b[1;34m(self, state_dict, strict)\u001b[0m\n\u001b[0;32m 1971\u001b[0m \u001b[38;5;124mr\u001b[39m\u001b[38;5;124;03m\"\"\"Copies parameters and buffers from :attr:`state_dict` into\u001b[39;00m\n\u001b[0;32m 1972\u001b[0m \u001b[38;5;124;03mthis module and its descendants. If :attr:`strict` is ``True``, then\u001b[39;00m\n\u001b[0;32m 1973\u001b[0m \u001b[38;5;124;03mthe keys of :attr:`state_dict` must exactly match the keys returned\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 1991\u001b[0m \u001b[38;5;124;03m ``RuntimeError``.\u001b[39;00m\n\u001b[0;32m 1992\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 1993\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(state_dict, Mapping):\n\u001b[1;32m-> 1994\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mExpected state_dict to be dict-like, got \u001b[39m\u001b[38;5;132;01m{}\u001b[39;00m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m.\u001b[39mformat(\u001b[38;5;28mtype\u001b[39m(state_dict)))\n\u001b[0;32m 1996\u001b[0m missing_keys: List[\u001b[38;5;28mstr\u001b[39m] \u001b[38;5;241m=\u001b[39m []\n\u001b[0;32m 1997\u001b[0m unexpected_keys: List[\u001b[38;5;28mstr\u001b[39m] \u001b[38;5;241m=\u001b[39m []\n",
"\u001b[1;31mTypeError\u001b[0m: Expected state_dict to be dict-like, got <class '__main__.theCNN'>."
]
}
],
"source": [
"model = theCNN()\n",
"model.load_state_dict(torch.load(\"model.pth\"))\n",
"model.eval()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "18b869d3",
"metadata": {},
"outputs": [],
"source": [
"@app.post(\"/score\")\n",
"async def calculate_score(image_file: UploadFile):\n",
" image = Image.open(io.BytesIO(await image_file.read())).convert(\"L\")\n",
" image = transform(image).unsqueeze(0)\n",
"\n",
" with torch.no_grad():\n",
" output = model(image)\n",
"\n",
" probabilities = torch.softmax(output, dim=1)[0]\n",
" similarity_scores = probabilities.numpy()\n",
"\n",
" return {\"similarity_scores\": similarity_scores.tolist()}"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4a99a8b6",
"metadata": {},
"outputs": [],
"source": [
"@app.get(\"/\")\n",
"async def hello_world(): \n",
"\n",
" return {\"Hello World\"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7b30f5c6",
"metadata": {},
"outputs": [],
"source": [
"if __name__ == \"__main__\":\n",
" loop = asyncio.get_event_loop()\n",
" loop.create_task(uvicorn.run(app, host=\"127.0.0.1\", port=8001))\n",
" loop.run_forever()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3e2e07d8",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "60c58fd2",
"metadata": {},
"outputs": [],
"source": [
"import nest_asyncio\n",
"import asyncio\n",
"import torch.nn.functional as F\n",
"\n",
"# Apply the patch\n",
"nest_asyncio.apply()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "c1b7af91",
"metadata": {},
"outputs": [],
"source": [
"from fastapi import FastAPI, UploadFile\n",
"from PIL import Image\n",
"import torch\n",
"import torchvision.transforms as transforms\n",
"import numpy as np\n",
"import io\n",
"import torch.nn as nn\n",
"import asyncio\n",
"import uvicorn \n",
"from io import BytesIO"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "7f1cd8a4",
"metadata": {},
"outputs": [],
"source": [
"app = FastAPI()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "2035acf5",
"metadata": {},
"outputs": [],
"source": [
"transform = transforms.Compose([\n",
" transforms.Resize((300, 300)),\n",
" transforms.Grayscale(num_output_channels=1),\n",
" transforms.ToTensor(),\n",
" transforms.Normalize(mean=(0.5), std=(0.5))\n",
"])"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "2cfca47d",
"metadata": {},
"outputs": [],
"source": [
"class theCNN(nn.Module):\n",
" def __init__(self):\n",
" super(theCNN, self).__init__()\n",
" \n",
" self.conv01 = nn.Conv2d(\n",
" in_channels=1,\n",
" out_channels=10,\n",
" kernel_size=5,\n",
" stride=1,\n",
" padding=1\n",
" )\n",
" \n",
" self.conv02 = nn.Conv2d(\n",
" in_channels=10,\n",
" out_channels=20,\n",
" kernel_size=5,\n",
" stride=1,\n",
" padding=1\n",
" )\n",
" \n",
" expectedSize = int(np.floor((73 + 2 * 0 - 1) / 1) + 1)\n",
" expectedSize = 20 * int(expectedSize ** 2)\n",
" \n",
" self.fc01 = nn.Linear(expectedSize, 50)\n",
" self.output = nn.Linear(50, 16)\n",
"\n",
" def forward(self, x):\n",
" x = F.relu(F.max_pool2d(self.conv01(x), 2))\n",
" x = F.relu(F.max_pool2d(self.conv02(x), 2))\n",
" nUnits = x.shape.numel() / x.shape[0]\n",
" x = x.view(-1, int(nUnits))\n",
" x = F.relu(self.fc01(x))\n",
" return torch.softmax(self.output(x), axis=1)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "2786c4df",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"theCNN(\n",
" (conv01): Conv2d(1, 10, kernel_size=(5, 5), stride=(1, 1), padding=(1, 1))\n",
" (conv02): Conv2d(10, 20, kernel_size=(5, 5), stride=(1, 1), padding=(1, 1))\n",
" (fc01): Linear(in_features=106580, out_features=50, bias=True)\n",
" (output): Linear(in_features=50, out_features=16, bias=True)\n",
")"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model = theCNN()\n",
"model.load_state_dict(torch.load(\"model.pth\"))\n",
"model.eval()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "30569105",
"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",
"# 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}"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "5c19e31c",
"metadata": {},
"outputs": [],
"source": [
"@app.get(\"/\")\n",
"async def hello_world(): \n",
"\n",
" return {\"Hello World\"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bea39dc9",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: Started server process [36440]\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"
]
},
{
"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"
]
}
],
"source": [
"if __name__ == \"__main__\":\n",
" loop = asyncio.get_event_loop()\n",
" loop.create_task(uvicorn.run(app, host=\"127.0.0.1\", port=8001))\n",
" loop.run_forever()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "52ede8b7",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "3d7bb1db",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Defaulting to user installation because normal site-packages is not writeable\n",
"Requirement already satisfied: torchvision in c:\\users\\janithgamage\\appdata\\roaming\\python\\python310\\site-packages (0.15.2)\n",
"Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from torchvision) (9.4.0)\n",
"Requirement already satisfied: torch==2.0.1 in c:\\users\\janithgamage\\appdata\\roaming\\python\\python310\\site-packages (from torchvision) (2.0.1)\n",
"Requirement already satisfied: requests in c:\\programdata\\anaconda3\\lib\\site-packages (from torchvision) (2.28.1)\n",
"Requirement already satisfied: numpy in c:\\programdata\\anaconda3\\lib\\site-packages (from torchvision) (1.23.5)\n",
"Requirement already satisfied: jinja2 in c:\\programdata\\anaconda3\\lib\\site-packages (from torch==2.0.1->torchvision) (3.1.2)\n",
"Requirement already satisfied: networkx in c:\\programdata\\anaconda3\\lib\\site-packages (from torch==2.0.1->torchvision) (2.8.4)\n",
"Requirement already satisfied: sympy in c:\\programdata\\anaconda3\\lib\\site-packages (from torch==2.0.1->torchvision) (1.11.1)\n",
"Requirement already satisfied: filelock in c:\\programdata\\anaconda3\\lib\\site-packages (from torch==2.0.1->torchvision) (3.9.0)\n",
"Requirement already satisfied: typing-extensions in c:\\programdata\\anaconda3\\lib\\site-packages (from torch==2.0.1->torchvision) (4.4.0)\n",
"Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\\programdata\\anaconda3\\lib\\site-packages (from requests->torchvision) (1.26.14)\n",
"Requirement already satisfied: certifi>=2017.4.17 in c:\\programdata\\anaconda3\\lib\\site-packages (from requests->torchvision) (2022.12.7)\n",
"Requirement already satisfied: idna<4,>=2.5 in c:\\programdata\\anaconda3\\lib\\site-packages (from requests->torchvision) (3.4)\n",
"Requirement already satisfied: charset-normalizer<3,>=2 in c:\\programdata\\anaconda3\\lib\\site-packages (from requests->torchvision) (2.0.4)\n",
"Requirement already satisfied: MarkupSafe>=2.0 in c:\\programdata\\anaconda3\\lib\\site-packages (from jinja2->torch==2.0.1->torchvision) (2.1.1)\n",
"Requirement already satisfied: mpmath>=0.19 in c:\\programdata\\anaconda3\\lib\\site-packages (from sympy->torch==2.0.1->torchvision) (1.2.1)\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"pip install torchvision"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19",
"_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5",
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.578710Z",
"iopub.status.idle": "2023-05-21T06:28:52.579058Z",
"shell.execute_reply": "2023-05-21T06:28:52.578896Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.578879Z"
}
},
"outputs": [],
"source": [
"import torch\n",
"import torchvision\n",
"import torchvision.transforms as transforms\n",
"from PIL import Image\n",
"from torch.utils.data import Dataset\n",
"from torch.utils.data import DataLoader\n",
"import torch.nn as nn\n",
"import torch.nn.functional as F\n",
"import os\n",
"\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import re"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.580301Z",
"iopub.status.idle": "2023-05-21T06:28:52.580679Z",
"shell.execute_reply": "2023-05-21T06:28:52.580498Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.580481Z"
}
},
"outputs": [],
"source": [
"device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.581548Z",
"iopub.status.idle": "2023-05-21T06:28:52.581894Z",
"shell.execute_reply": "2023-05-21T06:28:52.581734Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.581717Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['eight', 'eleven_2', 'eleven_3', 'fifty_1', 'fifty_2', 'fifty_3', 'five', 'four & fourteen_2', 'fourteen_1', 'fourteen_3', 'nine', 'one & ten_2 & eleven_1', 'seven', 'six', 'ten_1', 'ten_3', 'thirteen_1', 'thirteen_3', 'thirty_1', 'thirty_2', 'thirty_3', 'three & thirteen_2', 'twenty_1', 'twenty_2', 'twenty_3', 'two', 'what', 'when_1', 'when_2', 'when_3', 'who', 'why']\n"
]
}
],
"source": [
"# data_dir = \"\"\"../input/sinhala-sign-language-dataset-tdj/Sn_sign_language_dataset\"\"\"\n",
"data_dir = \"\"\"C:/Users/JanithGamage/Desktop/Research/pyhon/Mdoel-1/DataSet/Sn_sign_language_dataset\"\"\"\n",
"classes = []\n",
"\n",
"for directory in os.listdir(data_dir):\n",
" if \".\" not in directory: # Removes .txt and segmentation script\n",
" classes.append(directory) \n",
"print(classes)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.583017Z",
"iopub.status.idle": "2023-05-21T06:28:52.583353Z",
"shell.execute_reply": "2023-05-21T06:28:52.583186Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.583169Z"
}
},
"outputs": [],
"source": [
"fp = []\n",
"class_name = []\n",
"for cls in classes:\n",
" files = os.listdir(f'{data_dir}/{cls}')\n",
" for file in files:\n",
" fp.append(f'{data_dir}/{cls}/{file}')\n",
" class_name.append(cls)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.584414Z",
"iopub.status.idle": "2023-05-21T06:28:52.584759Z",
"shell.execute_reply": "2023-05-21T06:28:52.584598Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.584580Z"
}
},
"outputs": [],
"source": [
"data = pd.DataFrame({\"File Path\":fp,\"Class\":class_name})"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.585665Z",
"iopub.status.idle": "2023-05-21T06:28:52.585993Z",
"shell.execute_reply": "2023-05-21T06:28:52.585834Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.585817Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"thirteen_1 668\n",
"six 598\n",
"thirteen_3 576\n",
"ten_1 467\n",
"twenty_1 463\n",
"why 438\n",
"eleven_3 435\n",
"seven 432\n",
"four & fourteen_2 423\n",
"three & thirteen_2 417\n",
"eight 416\n",
"two 386\n",
"one & ten_2 & eleven_1 383\n",
"five 381\n",
"what 375\n",
"ten_3 358\n",
"twenty_2 355\n",
"who 348\n",
"when_1 318\n",
"eleven_2 301\n",
"when_2 290\n",
"when_3 268\n",
"thirty_3 262\n",
"twenty_3 259\n",
"fifty_2 258\n",
"thirty_2 257\n",
"fifty_1 255\n",
"fifty_3 249\n",
"fourteen_3 246\n",
"thirty_1 230\n",
"fourteen_1 208\n",
"nine 136\n",
"Name: Class, dtype: int64"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data['Class'].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.587067Z",
"iopub.status.idle": "2023-05-21T06:28:52.587408Z",
"shell.execute_reply": "2023-05-21T06:28:52.587241Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.587224Z"
}
},
"outputs": [],
"source": [
"data['Class'] = data['Class'].apply(lambda x:x.title().replace(\"_\",\"\"))\n",
"data['Class'] = data['Class'].apply(lambda x:re.sub(r'[0-9]+', '', x))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.588313Z",
"iopub.status.idle": "2023-05-21T06:28:52.588671Z",
"shell.execute_reply": "2023-05-21T06:28:52.588490Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.588473Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"Thirteen 1244\n",
"Twenty 1077\n",
"When 876\n",
"Ten 825\n",
"Fifty 762\n",
"Thirty 749\n",
"Eleven 736\n",
"Six 598\n",
"Fourteen 454\n",
"Why 438\n",
"Seven 432\n",
"Four & Fourteen 423\n",
"Three & Thirteen 417\n",
"Eight 416\n",
"Two 386\n",
"One & Ten & Eleven 383\n",
"Five 381\n",
"What 375\n",
"Who 348\n",
"Nine 136\n",
"Name: Class, dtype: int64"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data['Class'].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.589898Z",
"iopub.status.idle": "2023-05-21T06:28:52.590257Z",
"shell.execute_reply": "2023-05-21T06:28:52.590086Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.590061Z"
}
},
"outputs": [],
"source": [
"clases_to_remove = ['When','Why','What','Who']"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.591203Z",
"iopub.status.idle": "2023-05-21T06:28:52.592014Z",
"shell.execute_reply": "2023-05-21T06:28:52.591818Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.591791Z"
}
},
"outputs": [],
"source": [
"data = data[data['Class'].apply(lambda x: True if x not in clases_to_remove else False)]"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.594622Z",
"iopub.status.idle": "2023-05-21T06:28:52.595000Z",
"shell.execute_reply": "2023-05-21T06:28:52.594827Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.594802Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"Thirteen 1244\n",
"Twenty 1077\n",
"Ten 825\n",
"Fifty 762\n",
"Thirty 749\n",
"Eleven 736\n",
"Six 598\n",
"Fourteen 454\n",
"Seven 432\n",
"Four & Fourteen 423\n",
"Three & Thirteen 417\n",
"Eight 416\n",
"Two 386\n",
"One & Ten & Eleven 383\n",
"Five 381\n",
"Nine 136\n",
"Name: Class, dtype: int64"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data['Class'].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.596472Z",
"iopub.status.idle": "2023-05-21T06:28:52.596896Z",
"shell.execute_reply": "2023-05-21T06:28:52.596708Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.596686Z"
}
},
"outputs": [],
"source": [
"transform = transforms.Compose([\n",
" transforms.Resize((300,300)),\n",
" transforms.Grayscale(num_output_channels=1),\n",
" transforms.ToTensor(),\n",
" transforms.Normalize(mean=(0.5),std=(0.5))\n",
" ])"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.598034Z",
"iopub.status.idle": "2023-05-21T06:28:52.598390Z",
"shell.execute_reply": "2023-05-21T06:28:52.598222Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.598200Z"
}
},
"outputs": [],
"source": [
"str_to_int = {key:val for val,key in enumerate(data['Class'].unique())}"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.600180Z",
"iopub.status.idle": "2023-05-21T06:28:52.600589Z",
"shell.execute_reply": "2023-05-21T06:28:52.600392Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.600367Z"
}
},
"outputs": [],
"source": [
"# str_to_int['One & Ten & Eleven'] = 1\n",
"# str_to_int['Two'] = 2\n",
"# str_to_int['Three & Thirteen'] = 3\n",
"# str_to_int['Four & Fourteen'] = 4\n",
"# str_to_int['Five'] = 5\n",
"# str_to_int['Six'] = 6\n",
"# str_to_int['Seven'] = 7\n",
"# str_to_int['Eight'] = 8\n",
"# str_to_int['Nine'] = 9\n",
"# str_to_int['Ten'] = 10\n",
"# str_to_int['Eleven'] = 11\n",
"# str_to_int['Thirteen'] = 13\n",
"# str_to_int['Fourteen'] = 14\n",
"# str_to_int['Twenty'] = 20\n",
"# str_to_int['Thirty'] = 30\n",
"# str_to_int['Fifty'] = 50"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T06:31:15.957270Z",
"iopub.status.busy": "2023-05-21T06:31:15.956916Z",
"iopub.status.idle": "2023-05-21T06:31:15.966787Z",
"shell.execute_reply": "2023-05-21T06:31:15.966023Z",
"shell.execute_reply.started": "2023-05-21T06:31:15.957230Z"
}
},
"outputs": [],
"source": [
"class MarkeDataset(Dataset):\n",
" def __init__(self, data, root_dir, transform=transforms.ToTensor()):\n",
" self.data = data\n",
" self.root_dir = root_dir\n",
" self.transform = transform\n",
" self.device = device\n",
" \n",
" def __len__(self):\n",
" return len(self.data)\n",
" \n",
" def __getitem__(self, idx):\n",
" if torch.is_tensor(idx):\n",
" idx = idx.tolist()\n",
" \n",
" img_name = self.data.iloc[idx, 0]\n",
" image = Image.open(img_name)\n",
" y_label = torch.tensor(str_to_int[self.data.iloc[idx, 1]]).to(self.device)\n",
" \n",
" if self.transform:\n",
" image = self.transform(image).to(self.device) \n",
" \n",
" return (image, y_label)\n",
"\n",
"# def __getitem__(self, idx):\n",
"# if torch.is_tensor(idx):\n",
"# idx = idx.tolist()\n",
"\n",
"# img_name = self.data.iloc[idx, 0]\n",
"# image = Image.open(img_name)\n",
"# y_label = torch.tensor(str_to_int[self.data.iloc[idx, 1]]).to(self.device)\n",
"# # y_label = torch.tensor(str_to_int[self.data.iloc[idx, 1]] - 1).to(self.device)\n",
"\n",
"# if self.transform:\n",
"# image = self.transform(image).to(self.device)\n",
"\n",
"# return (image, y_label)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T06:31:25.622005Z",
"iopub.status.busy": "2023-05-21T06:31:25.621491Z",
"iopub.status.idle": "2023-05-21T06:31:25.626122Z",
"shell.execute_reply": "2023-05-21T06:31:25.625148Z",
"shell.execute_reply.started": "2023-05-21T06:31:25.621968Z"
}
},
"outputs": [],
"source": [
"dataset = MarkeDataset(\n",
" data=data,\n",
" root_dir=data_dir,\n",
" transform=transform\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.606586Z",
"iopub.status.idle": "2023-05-21T06:28:52.606914Z",
"shell.execute_reply": "2023-05-21T06:28:52.606754Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.606737Z"
}
},
"outputs": [],
"source": [
"randIds = np.random.randint(0,1000,size=10)\n",
"fig,ax = plt.subplots(2,5,figsize=(15,5))\n",
"for i,axi in zip(randIds,ax.flatten()):\n",
" img, lab = dataset[i]\n",
" axi.imshow(img.cpu().numpy().transpose((1, 2, 0)),cmap='gray')\n",
" axi.text(x = 150,y =2,s =f'Label :{str(lab.item())}',ha='center',backgroundcolor='y')\n",
" axi.axis('off')\n",
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T06:32:07.139527Z",
"iopub.status.busy": "2023-05-21T06:32:07.139161Z",
"iopub.status.idle": "2023-05-21T06:32:07.146617Z",
"shell.execute_reply": "2023-05-21T06:32:07.145658Z",
"shell.execute_reply.started": "2023-05-21T06:32:07.139487Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"9419"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(dataset)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T06:32:13.912232Z",
"iopub.status.busy": "2023-05-21T06:32:13.911889Z",
"iopub.status.idle": "2023-05-21T06:32:13.920718Z",
"shell.execute_reply": "2023-05-21T06:32:13.919857Z",
"shell.execute_reply.started": "2023-05-21T06:32:13.912196Z"
}
},
"outputs": [],
"source": [
"# batch_size = 16\n",
"# train_set, test_set = torch.utils.data.random_split(dataset, [8000,1419])\n",
"# trainLoader = DataLoader(dataset=train_set,batch_size=batch_size,shuffle=True,drop_last=True)\n",
"# testLoader = DataLoader(dataset=test_set,batch_size=1419)\n",
"\n",
"batch_size = 16\n",
"\n",
"train_size = int(0.85 * len(dataset))\n",
"test_size = len(dataset) - train_size\n",
"\n",
"train_set, test_set = torch.utils.data.random_split(dataset, [train_size, test_size])\n",
"trainLoader = DataLoader(dataset=train_set, batch_size=batch_size, shuffle=True, drop_last=True)\n",
"testLoader = DataLoader(dataset=test_set, batch_size=len(test_set))"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T06:32:15.912440Z",
"iopub.status.busy": "2023-05-21T06:32:15.912118Z",
"iopub.status.idle": "2023-05-21T06:32:15.920625Z",
"shell.execute_reply": "2023-05-21T06:32:15.919790Z",
"shell.execute_reply.started": "2023-05-21T06:32:15.912404Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Metrix size after 1st conv. and maxpool layer: 149 X 149\n",
"Metrix size after 2nd conv. and maxpool layer: 73 X 73\n"
]
}
],
"source": [
"kernel_size = 5\n",
"stride = 1\n",
"padding = 1\n",
"\n",
"metrixSize1 = int(np.floor(300+2*padding-kernel_size/stride)+1)\n",
"metrixSize1 = int(np.floor(metrixSize1/2)) #applying 2x2 Max pooling operation\n",
"\n",
"metrixSize2 = int(np.floor(metrixSize1+2*padding-kernel_size/stride)+1)\n",
"metrixSize2 = int(np.floor(metrixSize2/2)) #applying 2x2 Max pooling operation\n",
"\n",
"print(f'Metrix size after 1st conv. and maxpool layer: {metrixSize1} X {metrixSize1}')\n",
"print(f'Metrix size after 2nd conv. and maxpool layer: {metrixSize2} X {metrixSize2}')"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T06:32:18.919815Z",
"iopub.status.busy": "2023-05-21T06:32:18.919472Z",
"iopub.status.idle": "2023-05-21T06:32:18.931885Z",
"shell.execute_reply": "2023-05-21T06:32:18.930832Z",
"shell.execute_reply.started": "2023-05-21T06:32:18.919776Z"
}
},
"outputs": [],
"source": [
"class theCNN(nn.Module):\n",
" def __init__(self):\n",
" super().__init__()\n",
" \n",
" self.conv01 = nn.Conv2d(\n",
" in_channels = 1,\n",
" out_channels = 10,\n",
" kernel_size = 5,\n",
" stride = 1,\n",
" padding = 1\n",
" )\n",
" \n",
" self.conv02 = nn.Conv2d(\n",
" in_channels = 10,\n",
" out_channels = 20,\n",
" kernel_size = 5,\n",
" stride = 1,\n",
" padding = 1\n",
" )\n",
" \n",
" expectedSize = np.floor((73+2*0-1)/1) +1 \n",
" expectedSize = 20*int(expectedSize**2)\n",
" \n",
" self.fc01 = nn.Linear(expectedSize,50)\n",
" self.output = nn.Linear(50,16)\n",
" \n",
" def forward(self,x):\n",
" \n",
" #convo -> maxpool -> relu\n",
" x = F.relu(F.max_pool2d(self.conv01(x),2))\n",
" \n",
" #convo -> maxpool -> relu\n",
" x = F.relu(F.max_pool2d(self.conv02(x),2))\n",
" \n",
" nUnits = x.shape.numel()/x.shape[0]\n",
" x = x.view(-1,int(nUnits))\n",
" \n",
" x = F.relu(self.fc01(x))\n",
" \n",
" return torch.softmax(self.output(x),axis=1)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T06:32:24.959976Z",
"iopub.status.busy": "2023-05-21T06:32:24.959650Z",
"iopub.status.idle": "2023-05-21T06:32:24.966633Z",
"shell.execute_reply": "2023-05-21T06:32:24.965555Z",
"shell.execute_reply.started": "2023-05-21T06:32:24.959940Z"
}
},
"outputs": [],
"source": [
"def createModel(lr):\n",
" net = theCNN()\n",
" lossFun = nn.CrossEntropyLoss()\n",
" optimizer = torch.optim.Adam(params=net.parameters(),lr=lr)\n",
" \n",
" return net,lossFun,optimizer"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T06:32:26.930919Z",
"iopub.status.busy": "2023-05-21T06:32:26.930365Z",
"iopub.status.idle": "2023-05-21T06:32:26.991834Z",
"shell.execute_reply": "2023-05-21T06:32:26.990918Z",
"shell.execute_reply.started": "2023-05-21T06:32:26.930881Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"tensor([[0.0721, 0.0794, 0.0530, 0.0484, 0.0692, 0.0618, 0.0585, 0.0723, 0.0629,\n",
" 0.0478, 0.0588, 0.0584, 0.0704, 0.0604, 0.0588, 0.0678]],\n",
" grad_fn=<SoftmaxBackward0>)"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"createModel(0.01)[0](torch.randn(1,1,300,300))"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T06:32:29.123842Z",
"iopub.status.busy": "2023-05-21T06:32:29.123530Z",
"iopub.status.idle": "2023-05-21T06:32:29.137330Z",
"shell.execute_reply": "2023-05-21T06:32:29.136105Z",
"shell.execute_reply.started": "2023-05-21T06:32:29.123809Z"
}
},
"outputs": [],
"source": [
"def trainModel(epochs, lr):\n",
" net, LossFun, optimizer = createModel(lr)\n",
" net = net.to(device)\n",
" losses = torch.zeros(epochs)\n",
" testAccuracy = torch.zeros(epochs)\n",
" trainAccuracy = torch.zeros(epochs)\n",
"\n",
" for i in range(epochs):\n",
" net.train()\n",
" batchLoss = []\n",
" batchAccuracy = []\n",
"\n",
" for X, y in trainLoader:\n",
" yHat = net(X)\n",
" loss = LossFun(yHat, y.squeeze())\n",
"\n",
" accuracy = 100 * torch.mean((torch.argmax(yHat, axis=1) == y.squeeze()).float())\n",
" batchAccuracy.append(accuracy.item())\n",
" batchLoss.append(loss.item())\n",
"\n",
" optimizer.zero_grad()\n",
" loss.backward()\n",
" optimizer.step()\n",
"\n",
" losses[i] = np.mean(batchLoss)\n",
" trainAccuracy[i] = np.mean(batchAccuracy)\n",
"\n",
" net.eval()\n",
" X, y = next(iter(testLoader))\n",
"\n",
" with torch.no_grad():\n",
" yHat = net(X)\n",
"\n",
" loss = LossFun(yHat, y.squeeze())\n",
" accuracy = 100 * torch.mean((torch.argmax(yHat, axis=1) == y.squeeze()).float())\n",
" testAccuracy[i] = accuracy\n",
" print(f'Test Accuracy: {accuracy:.3f}')\n",
" \n",
" # Save the trained model\n",
" torch.save(net.state_dict(), 'model.pth')\n",
"\n",
" return net, losses, testAccuracy, trainAccuracy\n",
"\n",
"net, losses, testAccuracy, trainAccuracy = trainModel(1, 1e-4)\n"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T06:32:33.702648Z",
"iopub.status.busy": "2023-05-21T06:32:33.702320Z"
},
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Test Accuracy: 78.132\n"
]
},
{
"ename": "ValueError",
"evalue": "not enough values to unpack (expected 6, got 4)",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)",
"File \u001b[1;32m<timed exec>:1\u001b[0m\n",
"\u001b[1;31mValueError\u001b[0m: not enough values to unpack (expected 6, got 4)"
]
}
],
"source": [
"%%time\n",
"net,losses,testAccuracy,trainAccuracy,yHat,X = trainModel(1,1e-4)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.623133Z",
"iopub.status.idle": "2023-05-21T06:28:52.624249Z",
"shell.execute_reply": "2023-05-21T06:28:52.623682Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.623638Z"
}
},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'testAccuracy' 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[25], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m plt\u001b[38;5;241m.\u001b[39mtitle(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mFinal test accuracy: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mtestAccuracy[\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m]\u001b[38;5;132;01m:\u001b[39;00m\u001b[38;5;124m.3f\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 2\u001b[0m plt\u001b[38;5;241m.\u001b[39mplot(testAccuracy,label\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mTest\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 3\u001b[0m plt\u001b[38;5;241m.\u001b[39mplot(trainAccuracy,label\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mTrain\u001b[39m\u001b[38;5;124m'\u001b[39m)\n",
"\u001b[1;31mNameError\u001b[0m: name 'testAccuracy' is not defined"
]
}
],
"source": [
"plt.title(f'Final test accuracy: {testAccuracy[-1]:.3f}')\n",
"plt.plot(testAccuracy,label='Test')\n",
"plt.plot(trainAccuracy,label='Train')\n",
"plt.legend()\n",
"plt.plot()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.630115Z",
"iopub.status.idle": "2023-05-21T06:28:52.630937Z",
"shell.execute_reply": "2023-05-21T06:28:52.630583Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.630547Z"
}
},
"outputs": [],
"source": [
"plt.title(f'Final train loss: {losses[-1]:.3f}')\n",
"plt.plot(losses)\n",
"plt.plot()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.635934Z",
"iopub.status.idle": "2023-05-21T06:28:52.637341Z",
"shell.execute_reply": "2023-05-21T06:28:52.636488Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.636414Z"
}
},
"outputs": [],
"source": [
"inv_map = dict(zip(str_to_int.values(), str_to_int.keys()))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.642433Z",
"iopub.status.idle": "2023-05-21T06:28:52.643393Z",
"shell.execute_reply": "2023-05-21T06:28:52.642984Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.642964Z"
}
},
"outputs": [],
"source": [
"predictions = torch.argmax(yHat,axis=1).cpu().detach().numpy().tolist()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.646236Z",
"iopub.status.idle": "2023-05-21T06:28:52.647698Z",
"shell.execute_reply": "2023-05-21T06:28:52.647036Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.646959Z"
}
},
"outputs": [],
"source": [
"predictions = list(map(lambda x: inv_map[x],predictions))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.653068Z",
"iopub.status.idle": "2023-05-21T06:28:52.654218Z",
"shell.execute_reply": "2023-05-21T06:28:52.653379Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.653291Z"
}
},
"outputs": [],
"source": [
"randIds = np.random.randint(0,1000,size=10)\n",
"fig,ax = plt.subplots(2,5,figsize=(15,5))\n",
"for i,axi in zip(randIds,ax.flatten()):\n",
" img = X[i]\n",
" axi.imshow(img.cpu().numpy().transpose((1, 2, 0)),cmap='gray')\n",
" axi.text(x = 150,y =2,s =f'Prediction :{predictions[i]}',ha='center',backgroundcolor='y')\n",
" axi.axis('off')\n",
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Todo\n",
" - Add Dropout\n",
" - Try Image augmentation techniques"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19",
"_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5",
"execution": {
"iopub.execute_input": "2023-05-21T15:21:22.473289Z",
"iopub.status.busy": "2023-05-21T15:21:22.472946Z",
"iopub.status.idle": "2023-05-21T15:21:22.479771Z",
"shell.execute_reply": "2023-05-21T15:21:22.478829Z",
"shell.execute_reply.started": "2023-05-21T15:21:22.473248Z"
}
},
"outputs": [],
"source": [
"import torch\n",
"import torchvision\n",
"import torchvision.transforms as transforms\n",
"from PIL import Image\n",
"from torch.utils.data import Dataset\n",
"from torch.utils.data import DataLoader\n",
"import torch.nn as nn\n",
"import torch.nn.functional as F\n",
"import os\n",
"\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import re"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:21:25.461226Z",
"iopub.status.busy": "2023-05-21T15:21:25.460874Z",
"iopub.status.idle": "2023-05-21T15:21:25.466436Z",
"shell.execute_reply": "2023-05-21T15:21:25.465440Z",
"shell.execute_reply.started": "2023-05-21T15:21:25.461185Z"
}
},
"outputs": [],
"source": [
"device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:21:27.486270Z",
"iopub.status.busy": "2023-05-21T15:21:27.485805Z",
"iopub.status.idle": "2023-05-21T15:21:27.513366Z",
"shell.execute_reply": "2023-05-21T15:21:27.512417Z",
"shell.execute_reply.started": "2023-05-21T15:21:27.486235Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['eight', 'eleven_2', 'eleven_3', 'fifty_1', 'fifty_2', 'fifty_3', 'five', 'four & fourteen_2', 'fourteen_1', 'fourteen_3', 'nine', 'one & ten_2 & eleven_1', 'seven', 'six', 'ten_1', 'ten_3', 'thirteen_1', 'thirteen_3', 'thirty_1', 'thirty_2', 'thirty_3', 'three & thirteen_2', 'twenty_1', 'twenty_2', 'twenty_3', 'two', 'what', 'when_1', 'when_2', 'when_3', 'who', 'why']\n"
]
}
],
"source": [
"# data_dir = \"\"\"../input/sinhala-sign-language-dataset-tdj/Sn_sign_language_dataset\"\"\"\n",
"data_dir = \"\"\"C:/Users/JanithGamage/Desktop/Research/pyhon/Mdoel-1/DataSet/Sn_sign_language_dataset\"\"\"\n",
"classes = []\n",
"\n",
"for directory in os.listdir(data_dir):\n",
" if \".\" not in directory: # Removes .txt and segmentation script\n",
" classes.append(directory) \n",
"print(classes)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:21:29.464717Z",
"iopub.status.busy": "2023-05-21T15:21:29.463975Z",
"iopub.status.idle": "2023-05-21T15:21:32.769963Z",
"shell.execute_reply": "2023-05-21T15:21:32.769064Z",
"shell.execute_reply.started": "2023-05-21T15:21:29.464662Z"
}
},
"outputs": [],
"source": [
"fp = []\n",
"class_name = []\n",
"for cls in classes:\n",
" files = os.listdir(f'{data_dir}/{cls}')\n",
" for file in files:\n",
" fp.append(f'{data_dir}/{cls}/{file}')\n",
" class_name.append(cls)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:21:37.426901Z",
"iopub.status.busy": "2023-05-21T15:21:37.426595Z",
"iopub.status.idle": "2023-05-21T15:21:37.439605Z",
"shell.execute_reply": "2023-05-21T15:21:37.438542Z",
"shell.execute_reply.started": "2023-05-21T15:21:37.426864Z"
}
},
"outputs": [],
"source": [
"data = pd.DataFrame({\"File Path\":fp,\"Class\":class_name})"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:21:38.852702Z",
"iopub.status.busy": "2023-05-21T15:21:38.852366Z",
"iopub.status.idle": "2023-05-21T15:21:38.876210Z",
"shell.execute_reply": "2023-05-21T15:21:38.875333Z",
"shell.execute_reply.started": "2023-05-21T15:21:38.852663Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"thirteen_1 668\n",
"six 598\n",
"thirteen_3 576\n",
"ten_1 467\n",
"twenty_1 463\n",
"why 438\n",
"eleven_3 435\n",
"seven 432\n",
"four & fourteen_2 423\n",
"three & thirteen_2 417\n",
"eight 416\n",
"two 386\n",
"one & ten_2 & eleven_1 383\n",
"five 381\n",
"what 375\n",
"ten_3 358\n",
"twenty_2 355\n",
"who 348\n",
"when_1 318\n",
"eleven_2 301\n",
"when_2 290\n",
"when_3 268\n",
"thirty_3 262\n",
"twenty_3 259\n",
"fifty_2 258\n",
"thirty_2 257\n",
"fifty_1 255\n",
"fifty_3 249\n",
"fourteen_3 246\n",
"thirty_1 230\n",
"fourteen_1 208\n",
"nine 136\n",
"Name: Class, dtype: int64"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data['Class'].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:21:40.858223Z",
"iopub.status.busy": "2023-05-21T15:21:40.857670Z",
"iopub.status.idle": "2023-05-21T15:21:40.901757Z",
"shell.execute_reply": "2023-05-21T15:21:40.900784Z",
"shell.execute_reply.started": "2023-05-21T15:21:40.858177Z"
}
},
"outputs": [],
"source": [
"data['Class'] = data['Class'].apply(lambda x:x.title().replace(\"_\",\"\"))\n",
"data['Class'] = data['Class'].apply(lambda x:re.sub(r'[0-9]+', '', x))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:21:43.784267Z",
"iopub.status.busy": "2023-05-21T15:21:43.783939Z",
"iopub.status.idle": "2023-05-21T15:21:43.796665Z",
"shell.execute_reply": "2023-05-21T15:21:43.795716Z",
"shell.execute_reply.started": "2023-05-21T15:21:43.784229Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"Thirteen 1244\n",
"Twenty 1077\n",
"When 876\n",
"Ten 825\n",
"Fifty 762\n",
"Thirty 749\n",
"Eleven 736\n",
"Six 598\n",
"Fourteen 454\n",
"Why 438\n",
"Seven 432\n",
"Four & Fourteen 423\n",
"Three & Thirteen 417\n",
"Eight 416\n",
"Two 386\n",
"One & Ten & Eleven 383\n",
"Five 381\n",
"What 375\n",
"Who 348\n",
"Nine 136\n",
"Name: Class, dtype: int64"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data['Class'].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:21:58.633864Z",
"iopub.status.busy": "2023-05-21T15:21:58.633538Z",
"iopub.status.idle": "2023-05-21T15:21:58.639024Z",
"shell.execute_reply": "2023-05-21T15:21:58.638410Z",
"shell.execute_reply.started": "2023-05-21T15:21:58.633832Z"
}
},
"outputs": [],
"source": [
"clases_to_remove = ['When','Why','What','Who']"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:00.893674Z",
"iopub.status.busy": "2023-05-21T15:22:00.893340Z",
"iopub.status.idle": "2023-05-21T15:22:00.908223Z",
"shell.execute_reply": "2023-05-21T15:22:00.907346Z",
"shell.execute_reply.started": "2023-05-21T15:22:00.893635Z"
}
},
"outputs": [],
"source": [
"data = data[data['Class'].apply(lambda x: True if x not in clases_to_remove else False)]"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:03.880606Z",
"iopub.status.busy": "2023-05-21T15:22:03.880248Z",
"iopub.status.idle": "2023-05-21T15:22:03.891999Z",
"shell.execute_reply": "2023-05-21T15:22:03.890999Z",
"shell.execute_reply.started": "2023-05-21T15:22:03.880571Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"Thirteen 1244\n",
"Twenty 1077\n",
"Ten 825\n",
"Fifty 762\n",
"Thirty 749\n",
"Eleven 736\n",
"Six 598\n",
"Fourteen 454\n",
"Seven 432\n",
"Four & Fourteen 423\n",
"Three & Thirteen 417\n",
"Eight 416\n",
"Two 386\n",
"One & Ten & Eleven 383\n",
"Five 381\n",
"Nine 136\n",
"Name: Class, dtype: int64"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data['Class'].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:06.096597Z",
"iopub.status.busy": "2023-05-21T15:22:06.096301Z",
"iopub.status.idle": "2023-05-21T15:22:06.102135Z",
"shell.execute_reply": "2023-05-21T15:22:06.101082Z",
"shell.execute_reply.started": "2023-05-21T15:22:06.096565Z"
}
},
"outputs": [],
"source": [
"transform = transforms.Compose([\n",
" transforms.Resize((300,300)),\n",
" transforms.Grayscale(num_output_channels=1),\n",
" transforms.ToTensor(),\n",
" transforms.Normalize(mean=(0.5),std=(0.5))\n",
" ])"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:08.359982Z",
"iopub.status.busy": "2023-05-21T15:22:08.359687Z",
"iopub.status.idle": "2023-05-21T15:22:08.367491Z",
"shell.execute_reply": "2023-05-21T15:22:08.366322Z",
"shell.execute_reply.started": "2023-05-21T15:22:08.359950Z"
}
},
"outputs": [],
"source": [
"str_to_int = {key:val for val,key in enumerate(data['Class'].unique())}"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:10.520408Z",
"iopub.status.busy": "2023-05-21T15:22:10.520069Z",
"iopub.status.idle": "2023-05-21T15:22:10.526070Z",
"shell.execute_reply": "2023-05-21T15:22:10.525115Z",
"shell.execute_reply.started": "2023-05-21T15:22:10.520373Z"
}
},
"outputs": [],
"source": [
"# str_to_int['One & Ten & Eleven'] = 1\n",
"# str_to_int['Two'] = 2\n",
"# str_to_int['Three & Thirteen'] = 3\n",
"# str_to_int['Four & Fourteen'] = 4\n",
"# str_to_int['Five'] = 5\n",
"# str_to_int['Six'] = 6\n",
"# str_to_int['Seven'] = 7\n",
"# str_to_int['Eight'] = 8\n",
"# str_to_int['Nine'] = 9\n",
"# str_to_int['Ten'] = 10\n",
"# str_to_int['Eleven'] = 11\n",
"# str_to_int['Thirteen'] = 13\n",
"# str_to_int['Fourteen'] = 14\n",
"# str_to_int['Twenty'] = 20\n",
"# str_to_int['Thirty'] = 30\n",
"# str_to_int['Fifty'] = 50"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:13.056196Z",
"iopub.status.busy": "2023-05-21T15:22:13.055853Z",
"iopub.status.idle": "2023-05-21T15:22:13.066406Z",
"shell.execute_reply": "2023-05-21T15:22:13.065062Z",
"shell.execute_reply.started": "2023-05-21T15:22:13.056132Z"
}
},
"outputs": [],
"source": [
"class MarkeDataset(Dataset):\n",
" def __init__(self, data, root_dir, transform=transforms.ToTensor()):\n",
" self.data = data\n",
" self.root_dir = root_dir\n",
" self.transform = transform\n",
" self.device = device\n",
" \n",
" def __len__(self):\n",
" return len(self.data)\n",
" \n",
" def __getitem__(self, idx):\n",
" if torch.is_tensor(idx):\n",
" idx = idx.tolist()\n",
" \n",
" img_name = self.data.iloc[idx, 0]\n",
" image = Image.open(img_name)\n",
" y_label = torch.tensor(str_to_int[self.data.iloc[idx, 1]]).to(self.device)\n",
" \n",
" if self.transform:\n",
" image = self.transform(image).to(self.device) \n",
" \n",
" return (image, y_label)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:26.257162Z",
"iopub.status.busy": "2023-05-21T15:22:26.256652Z",
"iopub.status.idle": "2023-05-21T15:22:26.261594Z",
"shell.execute_reply": "2023-05-21T15:22:26.260674Z",
"shell.execute_reply.started": "2023-05-21T15:22:26.257103Z"
}
},
"outputs": [],
"source": [
"dataset = MarkeDataset(\n",
" data=data,\n",
" root_dir=data_dir,\n",
" transform=transform\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:29.282820Z",
"iopub.status.busy": "2023-05-21T15:22:29.282505Z",
"iopub.status.idle": "2023-05-21T15:22:30.450098Z",
"shell.execute_reply": "2023-05-21T15:22:30.449111Z",
"shell.execute_reply.started": "2023-05-21T15:22:29.282785Z"
}
},
"outputs": [],
"source": [
"randIds = np.random.randint(0,1000,size=10)\n",
"fig,ax = plt.subplots(2,5,figsize=(15,5))\n",
"for i,axi in zip(randIds,ax.flatten()):\n",
" img, lab = dataset[i]\n",
" axi.imshow(img.cpu().numpy().transpose((1, 2, 0)),cmap='gray')\n",
" axi.text(x = 150,y =2,s =f'Label :{str(lab.item())}',ha='center',backgroundcolor='y')\n",
" axi.axis('off')\n",
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:34.686493Z",
"iopub.status.busy": "2023-05-21T15:22:34.686198Z",
"iopub.status.idle": "2023-05-21T15:22:34.692454Z",
"shell.execute_reply": "2023-05-21T15:22:34.691684Z",
"shell.execute_reply.started": "2023-05-21T15:22:34.686462Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"9419"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(dataset)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:38.619412Z",
"iopub.status.busy": "2023-05-21T15:22:38.618543Z",
"iopub.status.idle": "2023-05-21T15:22:38.635127Z",
"shell.execute_reply": "2023-05-21T15:22:38.634375Z",
"shell.execute_reply.started": "2023-05-21T15:22:38.619366Z"
}
},
"outputs": [],
"source": [
"batch_size = 16\n",
"train_set, test_set = torch.utils.data.random_split(dataset, [8000,1419])\n",
"trainLoader = DataLoader(dataset=train_set,batch_size=batch_size,shuffle=True,drop_last=True)\n",
"testLoader = DataLoader(dataset=test_set,batch_size=1419)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:41.806762Z",
"iopub.status.busy": "2023-05-21T15:22:41.806452Z",
"iopub.status.idle": "2023-05-21T15:22:41.815670Z",
"shell.execute_reply": "2023-05-21T15:22:41.814797Z",
"shell.execute_reply.started": "2023-05-21T15:22:41.806729Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Metrix size after 1st conv. and maxpool layer: 149 X 149\n",
"Metrix size after 2nd conv. and maxpool layer: 73 X 73\n"
]
}
],
"source": [
"kernel_size = 5\n",
"stride = 1\n",
"padding = 1\n",
"\n",
"metrixSize1 = int(np.floor(300+2*padding-kernel_size/stride)+1)\n",
"metrixSize1 = int(np.floor(metrixSize1/2)) #applying 2x2 Max pooling operation\n",
"\n",
"metrixSize2 = int(np.floor(metrixSize1+2*padding-kernel_size/stride)+1)\n",
"metrixSize2 = int(np.floor(metrixSize2/2)) #applying 2x2 Max pooling operation\n",
"\n",
"print(f'Metrix size after 1st conv. and maxpool layer: {metrixSize1} X {metrixSize1}')\n",
"print(f'Metrix size after 2nd conv. and maxpool layer: {metrixSize2} X {metrixSize2}')"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:44.572322Z",
"iopub.status.busy": "2023-05-21T15:22:44.571998Z",
"iopub.status.idle": "2023-05-21T15:22:44.585933Z",
"shell.execute_reply": "2023-05-21T15:22:44.584795Z",
"shell.execute_reply.started": "2023-05-21T15:22:44.572285Z"
}
},
"outputs": [],
"source": [
"class theCNN(nn.Module):\n",
" def __init__(self):\n",
" super().__init__()\n",
" \n",
" self.conv01 = nn.Conv2d(\n",
" in_channels = 1,\n",
" out_channels = 10,\n",
" kernel_size = 5,\n",
" stride = 1,\n",
" padding = 1\n",
" )\n",
" \n",
" self.conv02 = nn.Conv2d(\n",
" in_channels = 10,\n",
" out_channels = 20,\n",
" kernel_size = 5,\n",
" stride = 1,\n",
" padding = 1\n",
" )\n",
" \n",
" expectedSize = np.floor((73+2*0-1)/1) +1 \n",
" expectedSize = 20*int(expectedSize**2)\n",
" \n",
" self.fc01 = nn.Linear(expectedSize,50)\n",
" self.output = nn.Linear(50,16)\n",
" \n",
" def forward(self,x):\n",
" \n",
" #convo -> maxpool -> relu\n",
" x = F.relu(F.max_pool2d(self.conv01(x),2))\n",
" \n",
" #convo -> maxpool -> relu\n",
" x = F.relu(F.max_pool2d(self.conv02(x),2))\n",
" \n",
" nUnits = x.shape.numel()/x.shape[0]\n",
" x = x.view(-1,int(nUnits))\n",
" \n",
" x = F.relu(self.fc01(x))\n",
" \n",
" return torch.softmax(self.output(x),axis=1)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:49.860090Z",
"iopub.status.busy": "2023-05-21T15:22:49.859764Z",
"iopub.status.idle": "2023-05-21T15:22:49.865939Z",
"shell.execute_reply": "2023-05-21T15:22:49.864657Z",
"shell.execute_reply.started": "2023-05-21T15:22:49.860052Z"
}
},
"outputs": [],
"source": [
"def createModel(lr):\n",
" net = theCNN()\n",
" lossFun = nn.CrossEntropyLoss()\n",
" optimizer = torch.optim.Adam(params=net.parameters(),lr=lr)\n",
" \n",
" return net,lossFun,optimizer"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:51.830628Z",
"iopub.status.busy": "2023-05-21T15:22:51.830107Z",
"iopub.status.idle": "2023-05-21T15:22:52.032717Z",
"shell.execute_reply": "2023-05-21T15:22:52.031798Z",
"shell.execute_reply.started": "2023-05-21T15:22:51.830587Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"tensor([[0.0636, 0.0599, 0.0594, 0.0579, 0.0574, 0.0701, 0.0585, 0.0668, 0.0578,\n",
" 0.0632, 0.0598, 0.0619, 0.0726, 0.0633, 0.0666, 0.0611]],\n",
" grad_fn=<SoftmaxBackward0>)"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"createModel(0.01)[0](torch.randn(1,1,300,300))"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:55.120195Z",
"iopub.status.busy": "2023-05-21T15:22:55.119083Z",
"iopub.status.idle": "2023-05-21T15:22:55.134205Z",
"shell.execute_reply": "2023-05-21T15:22:55.133312Z",
"shell.execute_reply.started": "2023-05-21T15:22:55.120083Z"
}
},
"outputs": [],
"source": [
"def trainModel(epochs,lr):\n",
" net,LossFun,optimizer = createModel(lr)\n",
" net = net.to(device)\n",
" losses = torch.zeros(epochs)\n",
" testAccuracy = torch.zeros(epochs)\n",
" trainAccurscy = torch.zeros(epochs)\n",
"\n",
" for i in range(epochs):\n",
" print(\"start\")\n",
" net.train()\n",
" batchLoss = []\n",
" batchAccuracy = []\n",
" for X,y in trainLoader:\n",
" yHat = net(X)\n",
" loss = LossFun(yHat,y)\n",
" # print(yHat.item())\n",
"\n",
" accuracy = 100*torch.mean((torch.argmax(yHat,axis=1)==y).float())\n",
" batchAccuracy.append(accuracy.item())\n",
" batchLoss.append(loss.item())\n",
"\n",
" optimizer.zero_grad()\n",
" loss.backward()\n",
" optimizer.step()\n",
"\n",
" losses[i] = np.mean(batchLoss)\n",
" trainAccurscy[i] = np.mean(batchAccuracy)\n",
"\n",
" net.eval()\n",
" X,y = next(iter(testLoader))\n",
" with torch.no_grad():\n",
" yHat = net(X)\n",
" loss = LossFun(yHat,y)\n",
" accuracy = 100*torch.mean((torch.argmax(yHat,axis=1)==y).float())\n",
" testAccuracy[i] = accuracy\n",
" print(f'Test Accuracy: {accuracy:.3f}')\n",
" \n",
" # Save the trained model\n",
" print(\"save the model\")\n",
" #torch.save(net.state_dict(), 'model.pth') \n",
" torch.save(net, \"model1.pth\")\n",
"\n",
" \n",
" return net,losses,testAccuracy,trainAccurscy,yHat,X"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:58.112687Z",
"iopub.status.busy": "2023-05-21T15:22:58.112351Z"
}
},
"outputs": [],
"source": [
"%%time\n",
"net,losses,testAccuracy,trainAccuracy,yHat,X = trainModel(10,1e-4)\n",
"# net,losses,testAccuracy,trainAccuracy,yHat,X = trainModel(1,1e-4)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.623133Z",
"iopub.status.idle": "2023-05-21T06:28:52.624249Z",
"shell.execute_reply": "2023-05-21T06:28:52.623682Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.623638Z"
}
},
"outputs": [],
"source": [
"import torch\n",
"import torchvision\n",
"import torchvision.transforms as transforms\n",
"from PIL import Image\n",
"from torch.utils.data import Dataset\n",
"from torch.utils.data import DataLoader\n",
"import torch.nn as nn\n",
"import torch.nn.functional as F\n",
"import os\n",
"\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import re\n",
"\n",
"plt.title(f'Final test accuracy: {testAccuracy[-1]:.3f}')\n",
"plt.plot(testAccuracy,label='Test')\n",
"plt.plot(trainAccuracy,label='Train')\n",
"plt.legend()\n",
"plt.plot()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.630115Z",
"iopub.status.idle": "2023-05-21T06:28:52.630937Z",
"shell.execute_reply": "2023-05-21T06:28:52.630583Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.630547Z"
}
},
"outputs": [],
"source": [
"plt.title(f'Final train loss: {losses[-1]:.3f}')\n",
"plt.plot(losses)\n",
"plt.plot()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.635934Z",
"iopub.status.idle": "2023-05-21T06:28:52.637341Z",
"shell.execute_reply": "2023-05-21T06:28:52.636488Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.636414Z"
}
},
"outputs": [],
"source": [
"inv_map = dict(zip(str_to_int.values(), str_to_int.keys()))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.642433Z",
"iopub.status.idle": "2023-05-21T06:28:52.643393Z",
"shell.execute_reply": "2023-05-21T06:28:52.642984Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.642964Z"
}
},
"outputs": [],
"source": [
"predictions = torch.argmax(yHat,axis=1).cpu().detach().numpy().tolist()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.646236Z",
"iopub.status.idle": "2023-05-21T06:28:52.647698Z",
"shell.execute_reply": "2023-05-21T06:28:52.647036Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.646959Z"
}
},
"outputs": [],
"source": [
"predictions = list(map(lambda x: inv_map[x],predictions))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.653068Z",
"iopub.status.idle": "2023-05-21T06:28:52.654218Z",
"shell.execute_reply": "2023-05-21T06:28:52.653379Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.653291Z"
}
},
"outputs": [],
"source": [
"randIds = np.random.randint(0,1000,size=10)\n",
"fig,ax = plt.subplots(2,5,figsize=(15,5))\n",
"for i,axi in zip(randIds,ax.flatten()):\n",
" img = X[i]\n",
" axi.imshow(img.cpu().numpy().transpose((1, 2, 0)),cmap='gray')\n",
" axi.text(x = 150,y =2,s =f'Prediction :{predictions[i]}',ha='center',backgroundcolor='y')\n",
" axi.axis('off')\n",
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Todo\n",
" - Add Dropout\n",
" - Try Image augmentation techniques"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "49b49c05",
"metadata": {},
"outputs": [],
"source": [
"import nest_asyncio\n",
"import asyncio\n",
"import torch.nn.functional as F\n",
"import torch.nn as nn\n",
"import torchvision.transforms as transforms\n",
"import numpy as np\n",
"import io\n",
"import uvicorn\n",
"from fastapi import FastAPI, UploadFile\n",
"from PIL import Image\n",
"import torch"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3f0148a4",
"metadata": {},
"outputs": [],
"source": [
"nest_asyncio.apply()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "26e5f198",
"metadata": {},
"outputs": [],
"source": [
"app = FastAPI()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d4359663",
"metadata": {},
"outputs": [],
"source": [
"transform = transforms.Compose([\n",
" transforms.Resize((300, 300)),\n",
" transforms.Grayscale(num_output_channels=1),\n",
" transforms.ToTensor(),\n",
" transforms.Normalize(mean=(0.5), std=(0.5))\n",
"])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "308a25d3",
"metadata": {},
"outputs": [],
"source": [
"class theCNN(nn.Module):\n",
" def __init__(self):\n",
" super(theCNN, self).__init__()\n",
" \n",
" self.conv01 = nn.Conv2d(\n",
" in_channels=1,\n",
" out_channels=10,\n",
" kernel_size=5,\n",
" stride=1,\n",
" padding=1\n",
" )\n",
" \n",
" self.conv02 = nn.Conv2d(\n",
" in_channels=10,\n",
" out_channels=20,\n",
" kernel_size=5,\n",
" stride=1,\n",
" padding=1\n",
" )\n",
" \n",
" expectedSize = int(np.floor((73 + 2 * 0 - 1) / 1) + 1)\n",
" expectedSize = 20 * int(expectedSize ** 2)\n",
" \n",
" self.fc01 = nn.Linear(expectedSize, 50)\n",
" self.output = nn.Linear(50, 16)\n",
"\n",
" def forward(self, x):\n",
" x = F.relu(F.max_pool2d(self.conv01(x), 2))\n",
" x = F.relu(F.max_pool2d(self.conv02(x), 2))\n",
" nUnits = x.shape.numel() / x.shape[0]\n",
" x = x.view(-1, int(nUnits))\n",
" x = F.relu(self.fc01(x))\n",
" return torch.softmax(self.output(x), axis=1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4e3544d2",
"metadata": {},
"outputs": [],
"source": [
"model = theCNN()\n",
"model.load_state_dict(torch.load(\"model.pth\"))\n",
"model.eval()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d521a8ca",
"metadata": {},
"outputs": [],
"source": [
"@app.post(\"/score\")\n",
"async def calculate_score(image_file: UploadFile):\n",
" image = Image.open(io.BytesIO(await image_file.read())).convert(\"L\")\n",
" image = transform(image).unsqueeze(0)\n",
"\n",
" with torch.no_grad():\n",
" output = model(image)\n",
"\n",
" probabilities = torch.softmax(output, dim=1)[0]\n",
" predicted_class = torch.argmax(probabilities).item()\n",
"\n",
" # Get the actual number corresponding to the hand sign\n",
" actual_number = get_actual_number_from_image(image)\n",
" \n",
" print(actual_number)\n",
"\n",
" # Compare predicted class with actual number and calculate correctness percentage\n",
" correct = int(predicted_class + 1 == actual_number)\n",
" print(correct)\n",
" correctness_percentage = correct / 1.0 * 100.0\n",
"\n",
" return {\"predicted_class\": predicted_class, \"correctness_percentage\": correctness_percentage}"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "030c5fbc",
"metadata": {},
"outputs": [],
"source": [
"import cv2\n",
"import numpy as np\n",
"\n",
"def get_actual_number_from_image(image):\n",
" # Convert the image to numpy array\n",
" image_array = np.array(image)\n",
"\n",
" # Apply image processing techniques to detect and recognize digits\n",
" # Example steps: thresholding, contour detection, character segmentation, digit recognition\n",
"\n",
" # Apply thresholding\n",
" _, binary_image = cv2.threshold(image_array, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)\n",
"\n",
" # Find contours\n",
" contours, _ = cv2.findContours(binary_image, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)\n",
"\n",
" # Sort contours based on their x-coordinate\n",
" contours = sorted(contours, key=lambda cnt: cv2.boundingRect(cnt)[0])\n",
"\n",
" # Initialize the recognized digit sequence\n",
" digit_sequence = \"\"\n",
"\n",
" # Iterate over the contours and recognize digits\n",
" for contour in contours:\n",
" # Get the bounding box of the contour\n",
" x, y, w, h = cv2.boundingRect(contour)\n",
"\n",
" # Crop the digit region from the image\n",
" digit_image = binary_image[y:y + h, x:x + w]\n",
"\n",
" # Resize the digit image to a fixed size (e.g., 28x28)\n",
" resized_digit_image = cv2.resize(digit_image, (28, 28))\n",
"\n",
" # Preprocess the resized digit image (e.g., normalize pixel values)\n",
" preprocessed_digit_image = resized_digit_image / 255.0\n",
"\n",
" # Flatten the preprocessed digit image\n",
" flattened_digit_image = preprocessed_digit_image.flatten()\n",
"\n",
" # Pass the flattened digit image to your digit recognition model\n",
" # to get the predicted digit (e.g., using a separate model or the same model you used for training)\n",
"\n",
" # Here, let's assume you have a function `predict_digit` that takes the flattened digit image\n",
" # and returns the predicted digit as an integer\n",
" predicted_digit = predict_digit(flattened_digit_image)\n",
"\n",
" # Add the predicted digit to the digit sequence\n",
" digit_sequence += str(predicted_digit)\n",
"\n",
" # Convert the digit sequence to an integer\n",
" actual_number = int(digit_sequence)\n",
"\n",
" return actual_number\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5035c79a",
"metadata": {},
"outputs": [],
"source": [
"if __name__ == \"__main__\":\n",
" loop = asyncio.get_event_loop()\n",
" loop.create_task(uvicorn.run(app, host=\"127.0.0.1\", port=8001))\n",
" loop.run_forever()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c0449757",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "c898b57c",
"metadata": {},
"outputs": [],
"source": [
"pip install python-multipart"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a99b4156",
"metadata": {},
"outputs": [],
"source": [
"import nest_asyncio\n",
"import asyncio\n",
"import torch.nn.functional as F\n",
"\n",
"# Apply the patch\n",
"nest_asyncio.apply()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "01b6e57c",
"metadata": {},
"outputs": [],
"source": [
"from fastapi import FastAPI, UploadFile\n",
"from PIL import Image\n",
"import torch\n",
"import torchvision.transforms as transforms\n",
"import numpy as np\n",
"import io\n",
"import torch.nn as nn\n",
"import asyncio\n",
"import uvicorn "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2e561f13",
"metadata": {},
"outputs": [],
"source": [
"app = FastAPI()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1e9e4208",
"metadata": {},
"outputs": [],
"source": [
"transform = transforms.Compose([\n",
" transforms.Resize((300, 300)),\n",
" transforms.Grayscale(num_output_channels=1),\n",
" transforms.ToTensor(),\n",
" transforms.Normalize(mean=(0.5), std=(0.5))\n",
"])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4d86d2b8",
"metadata": {},
"outputs": [],
"source": [
"class theCNN(nn.Module):\n",
" def __init__(self):\n",
" super(theCNN, self).__init__()\n",
" \n",
" self.conv01 = nn.Conv2d(\n",
" in_channels=1,\n",
" out_channels=10,\n",
" kernel_size=5,\n",
" stride=1,\n",
" padding=1\n",
" )\n",
" \n",
" self.conv02 = nn.Conv2d(\n",
" in_channels=10,\n",
" out_channels=20,\n",
" kernel_size=5,\n",
" stride=1,\n",
" padding=1\n",
" )\n",
" \n",
" expectedSize = int(np.floor((73 + 2 * 0 - 1) / 1) + 1)\n",
" expectedSize = 20 * int(expectedSize ** 2)\n",
" \n",
" self.fc01 = nn.Linear(expectedSize, 50)\n",
" self.output = nn.Linear(50, 16)\n",
"\n",
" def forward(self, x):\n",
" x = F.relu(F.max_pool2d(self.conv01(x), 2))\n",
" x = F.relu(F.max_pool2d(self.conv02(x), 2))\n",
" nUnits = x.shape.numel() / x.shape[0]\n",
" x = x.view(-1, int(nUnits))\n",
" x = F.relu(self.fc01(x))\n",
" return torch.softmax(self.output(x), axis=1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9379bf73",
"metadata": {},
"outputs": [],
"source": [
"model = theCNN()\n",
"model.load_state_dict(torch.load(\"model.pth\"))\n",
"model.eval()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "18b869d3",
"metadata": {},
"outputs": [],
"source": [
"@app.post(\"/score\")\n",
"async def calculate_score(image_file: UploadFile):\n",
" image = Image.open(io.BytesIO(await image_file.read())).convert(\"L\")\n",
" image = transform(image).unsqueeze(0)\n",
"\n",
" with torch.no_grad():\n",
" output = model(image)\n",
"\n",
" probabilities = torch.softmax(output, dim=1)[0]\n",
" similarity_scores = probabilities.numpy()\n",
"\n",
" return {\"similarity_scores\": similarity_scores.tolist()}"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4a99a8b6",
"metadata": {},
"outputs": [],
"source": [
"@app.get(\"/\")\n",
"async def hello_world(): \n",
"\n",
" return {\"Hello World\"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7b30f5c6",
"metadata": {},
"outputs": [],
"source": [
"if __name__ == \"__main__\":\n",
" loop = asyncio.get_event_loop()\n",
" loop.create_task(uvicorn.run(app, host=\"127.0.0.1\", port=8001))\n",
" loop.run_forever()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3e2e07d8",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "3d735e52",
"metadata": {},
"outputs": [],
"source": [
"import nest_asyncio\n",
"import asyncio\n",
"import torch.nn.functional as F\n",
"\n",
"# Apply the patch\n",
"nest_asyncio.apply()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "db756418",
"metadata": {},
"outputs": [],
"source": [
"from fastapi import FastAPI, UploadFile\n",
"from PIL import Image\n",
"import torch\n",
"import torchvision.transforms as transforms\n",
"import numpy as np\n",
"import io\n",
"import torch.nn as nn\n",
"import asyncio\n",
"import uvicorn \n",
"from io import BytesIO"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "fc83d1b8",
"metadata": {},
"outputs": [],
"source": [
"app = FastAPI()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "63dbfc01",
"metadata": {},
"outputs": [],
"source": [
"transform = transforms.Compose([\n",
" transforms.Resize((300, 300)),\n",
" transforms.Grayscale(num_output_channels=1),\n",
" transforms.ToTensor(),\n",
" transforms.Normalize(mean=(0.5), std=(0.5))\n",
"])"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "f7e5cdba",
"metadata": {},
"outputs": [],
"source": [
"class theCNN(nn.Module):\n",
" def __init__(self):\n",
" super(theCNN, self).__init__()\n",
" \n",
" self.conv01 = nn.Conv2d(\n",
" in_channels=1,\n",
" out_channels=10,\n",
" kernel_size=5,\n",
" stride=1,\n",
" padding=1\n",
" )\n",
" \n",
" self.conv02 = nn.Conv2d(\n",
" in_channels=10,\n",
" out_channels=20,\n",
" kernel_size=5,\n",
" stride=1,\n",
" padding=1\n",
" )\n",
" \n",
" expectedSize = int(np.floor((73 + 2 * 0 - 1) / 1) + 1)\n",
" expectedSize = 20 * int(expectedSize ** 2)\n",
" \n",
" self.fc01 = nn.Linear(expectedSize, 50)\n",
" self.output = nn.Linear(50, 16)\n",
"\n",
" def forward(self, x):\n",
" x = F.relu(F.max_pool2d(self.conv01(x), 2))\n",
" x = F.relu(F.max_pool2d(self.conv02(x), 2))\n",
" nUnits = x.shape.numel() / x.shape[0]\n",
" x = x.view(-1, int(nUnits))\n",
" x = F.relu(self.fc01(x))\n",
" return torch.softmax(self.output(x), axis=1)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "d86a9515",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"theCNN(\n",
" (conv01): Conv2d(1, 10, kernel_size=(5, 5), stride=(1, 1), padding=(1, 1))\n",
" (conv02): Conv2d(10, 20, kernel_size=(5, 5), stride=(1, 1), padding=(1, 1))\n",
" (fc01): Linear(in_features=106580, out_features=50, bias=True)\n",
" (output): Linear(in_features=50, out_features=16, bias=True)\n",
")"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model = theCNN()\n",
"model.load_state_dict(torch.load(\"model.pth\"))\n",
"model.eval()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"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",
"# 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}"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "df08611e",
"metadata": {},
"outputs": [],
"source": [
"@app.get(\"/\")\n",
"async def hello_world(): \n",
"\n",
" return {\"Hello World\"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "84b9601b",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: Started server process [36440]\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"
]
},
{
"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"
]
}
],
"source": [
"if __name__ == \"__main__\":\n",
" loop = asyncio.get_event_loop()\n",
" loop.create_task(uvicorn.run(app, host=\"127.0.0.1\", port=8001))\n",
" loop.run_forever()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ab358400",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "504cf81d",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19",
"_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5",
"execution": {
"iopub.execute_input": "2023-05-21T15:21:22.473289Z",
"iopub.status.busy": "2023-05-21T15:21:22.472946Z",
"iopub.status.idle": "2023-05-21T15:21:22.479771Z",
"shell.execute_reply": "2023-05-21T15:21:22.478829Z",
"shell.execute_reply.started": "2023-05-21T15:21:22.473248Z"
}
},
"outputs": [],
"source": [
"import torch\n",
"import torchvision\n",
"import torchvision.transforms as transforms\n",
"from PIL import Image\n",
"from torch.utils.data import Dataset\n",
"from torch.utils.data import DataLoader\n",
"import torch.nn as nn\n",
"import torch.nn.functional as F\n",
"import os\n",
"\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import re"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:21:25.461226Z",
"iopub.status.busy": "2023-05-21T15:21:25.460874Z",
"iopub.status.idle": "2023-05-21T15:21:25.466436Z",
"shell.execute_reply": "2023-05-21T15:21:25.465440Z",
"shell.execute_reply.started": "2023-05-21T15:21:25.461185Z"
}
},
"outputs": [],
"source": [
"device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:21:27.486270Z",
"iopub.status.busy": "2023-05-21T15:21:27.485805Z",
"iopub.status.idle": "2023-05-21T15:21:27.513366Z",
"shell.execute_reply": "2023-05-21T15:21:27.512417Z",
"shell.execute_reply.started": "2023-05-21T15:21:27.486235Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['eight', 'eleven_2', 'eleven_3', 'fifty_1', 'fifty_2', 'fifty_3', 'five', 'four & fourteen_2', 'fourteen_1', 'fourteen_3', 'nine', 'one & ten_2 & eleven_1', 'seven', 'six', 'ten_1', 'ten_3', 'thirteen_1', 'thirteen_3', 'thirty_1', 'thirty_2', 'thirty_3', 'three & thirteen_2', 'twenty_1', 'twenty_2', 'twenty_3', 'two', 'what', 'when_1', 'when_2', 'when_3', 'who', 'why']\n"
]
}
],
"source": [
"# data_dir = \"\"\"../input/sinhala-sign-language-dataset-tdj/Sn_sign_language_dataset\"\"\"\n",
"data_dir = \"\"\"C:/Users/JanithGamage/Desktop/Research/pyhon/Mdoel-1/DataSet/Sn_sign_language_dataset\"\"\"\n",
"classes = []\n",
"\n",
"for directory in os.listdir(data_dir):\n",
" if \".\" not in directory: # Removes .txt and segmentation script\n",
" classes.append(directory) \n",
"print(classes)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:21:29.464717Z",
"iopub.status.busy": "2023-05-21T15:21:29.463975Z",
"iopub.status.idle": "2023-05-21T15:21:32.769963Z",
"shell.execute_reply": "2023-05-21T15:21:32.769064Z",
"shell.execute_reply.started": "2023-05-21T15:21:29.464662Z"
}
},
"outputs": [],
"source": [
"fp = []\n",
"class_name = []\n",
"for cls in classes:\n",
" files = os.listdir(f'{data_dir}/{cls}')\n",
" for file in files:\n",
" fp.append(f'{data_dir}/{cls}/{file}')\n",
" class_name.append(cls)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:21:37.426901Z",
"iopub.status.busy": "2023-05-21T15:21:37.426595Z",
"iopub.status.idle": "2023-05-21T15:21:37.439605Z",
"shell.execute_reply": "2023-05-21T15:21:37.438542Z",
"shell.execute_reply.started": "2023-05-21T15:21:37.426864Z"
}
},
"outputs": [],
"source": [
"data = pd.DataFrame({\"File Path\":fp,\"Class\":class_name})"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:21:38.852702Z",
"iopub.status.busy": "2023-05-21T15:21:38.852366Z",
"iopub.status.idle": "2023-05-21T15:21:38.876210Z",
"shell.execute_reply": "2023-05-21T15:21:38.875333Z",
"shell.execute_reply.started": "2023-05-21T15:21:38.852663Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"thirteen_1 668\n",
"six 598\n",
"thirteen_3 576\n",
"ten_1 467\n",
"twenty_1 463\n",
"why 438\n",
"eleven_3 435\n",
"seven 432\n",
"four & fourteen_2 423\n",
"three & thirteen_2 417\n",
"eight 416\n",
"two 386\n",
"one & ten_2 & eleven_1 383\n",
"five 381\n",
"what 375\n",
"ten_3 358\n",
"twenty_2 355\n",
"who 348\n",
"when_1 318\n",
"eleven_2 301\n",
"when_2 290\n",
"when_3 268\n",
"thirty_3 262\n",
"twenty_3 259\n",
"fifty_2 258\n",
"thirty_2 257\n",
"fifty_1 255\n",
"fifty_3 249\n",
"fourteen_3 246\n",
"thirty_1 230\n",
"fourteen_1 208\n",
"nine 136\n",
"Name: Class, dtype: int64"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data['Class'].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:21:40.858223Z",
"iopub.status.busy": "2023-05-21T15:21:40.857670Z",
"iopub.status.idle": "2023-05-21T15:21:40.901757Z",
"shell.execute_reply": "2023-05-21T15:21:40.900784Z",
"shell.execute_reply.started": "2023-05-21T15:21:40.858177Z"
}
},
"outputs": [],
"source": [
"data['Class'] = data['Class'].apply(lambda x:x.title().replace(\"_\",\"\"))\n",
"data['Class'] = data['Class'].apply(lambda x:re.sub(r'[0-9]+', '', x))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:21:43.784267Z",
"iopub.status.busy": "2023-05-21T15:21:43.783939Z",
"iopub.status.idle": "2023-05-21T15:21:43.796665Z",
"shell.execute_reply": "2023-05-21T15:21:43.795716Z",
"shell.execute_reply.started": "2023-05-21T15:21:43.784229Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"Thirteen 1244\n",
"Twenty 1077\n",
"When 876\n",
"Ten 825\n",
"Fifty 762\n",
"Thirty 749\n",
"Eleven 736\n",
"Six 598\n",
"Fourteen 454\n",
"Why 438\n",
"Seven 432\n",
"Four & Fourteen 423\n",
"Three & Thirteen 417\n",
"Eight 416\n",
"Two 386\n",
"One & Ten & Eleven 383\n",
"Five 381\n",
"What 375\n",
"Who 348\n",
"Nine 136\n",
"Name: Class, dtype: int64"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data['Class'].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:21:58.633864Z",
"iopub.status.busy": "2023-05-21T15:21:58.633538Z",
"iopub.status.idle": "2023-05-21T15:21:58.639024Z",
"shell.execute_reply": "2023-05-21T15:21:58.638410Z",
"shell.execute_reply.started": "2023-05-21T15:21:58.633832Z"
}
},
"outputs": [],
"source": [
"clases_to_remove = ['When','Why','What','Who']"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:00.893674Z",
"iopub.status.busy": "2023-05-21T15:22:00.893340Z",
"iopub.status.idle": "2023-05-21T15:22:00.908223Z",
"shell.execute_reply": "2023-05-21T15:22:00.907346Z",
"shell.execute_reply.started": "2023-05-21T15:22:00.893635Z"
}
},
"outputs": [],
"source": [
"data = data[data['Class'].apply(lambda x: True if x not in clases_to_remove else False)]"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:03.880606Z",
"iopub.status.busy": "2023-05-21T15:22:03.880248Z",
"iopub.status.idle": "2023-05-21T15:22:03.891999Z",
"shell.execute_reply": "2023-05-21T15:22:03.890999Z",
"shell.execute_reply.started": "2023-05-21T15:22:03.880571Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"Thirteen 1244\n",
"Twenty 1077\n",
"Ten 825\n",
"Fifty 762\n",
"Thirty 749\n",
"Eleven 736\n",
"Six 598\n",
"Fourteen 454\n",
"Seven 432\n",
"Four & Fourteen 423\n",
"Three & Thirteen 417\n",
"Eight 416\n",
"Two 386\n",
"One & Ten & Eleven 383\n",
"Five 381\n",
"Nine 136\n",
"Name: Class, dtype: int64"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data['Class'].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:06.096597Z",
"iopub.status.busy": "2023-05-21T15:22:06.096301Z",
"iopub.status.idle": "2023-05-21T15:22:06.102135Z",
"shell.execute_reply": "2023-05-21T15:22:06.101082Z",
"shell.execute_reply.started": "2023-05-21T15:22:06.096565Z"
}
},
"outputs": [],
"source": [
"transform = transforms.Compose([\n",
" transforms.Resize((300,300)),\n",
" transforms.Grayscale(num_output_channels=1),\n",
" transforms.ToTensor(),\n",
" transforms.Normalize(mean=(0.5),std=(0.5))\n",
" ])"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:08.359982Z",
"iopub.status.busy": "2023-05-21T15:22:08.359687Z",
"iopub.status.idle": "2023-05-21T15:22:08.367491Z",
"shell.execute_reply": "2023-05-21T15:22:08.366322Z",
"shell.execute_reply.started": "2023-05-21T15:22:08.359950Z"
}
},
"outputs": [],
"source": [
"str_to_int = {key:val for val,key in enumerate(data['Class'].unique())}"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:10.520408Z",
"iopub.status.busy": "2023-05-21T15:22:10.520069Z",
"iopub.status.idle": "2023-05-21T15:22:10.526070Z",
"shell.execute_reply": "2023-05-21T15:22:10.525115Z",
"shell.execute_reply.started": "2023-05-21T15:22:10.520373Z"
}
},
"outputs": [],
"source": [
"# str_to_int['One & Ten & Eleven'] = 1\n",
"# str_to_int['Two'] = 2\n",
"# str_to_int['Three & Thirteen'] = 3\n",
"# str_to_int['Four & Fourteen'] = 4\n",
"# str_to_int['Five'] = 5\n",
"# str_to_int['Six'] = 6\n",
"# str_to_int['Seven'] = 7\n",
"# str_to_int['Eight'] = 8\n",
"# str_to_int['Nine'] = 9\n",
"# str_to_int['Ten'] = 10\n",
"# str_to_int['Eleven'] = 11\n",
"# str_to_int['Thirteen'] = 13\n",
"# str_to_int['Fourteen'] = 14\n",
"# str_to_int['Twenty'] = 20\n",
"# str_to_int['Thirty'] = 30\n",
"# str_to_int['Fifty'] = 50"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:13.056196Z",
"iopub.status.busy": "2023-05-21T15:22:13.055853Z",
"iopub.status.idle": "2023-05-21T15:22:13.066406Z",
"shell.execute_reply": "2023-05-21T15:22:13.065062Z",
"shell.execute_reply.started": "2023-05-21T15:22:13.056132Z"
}
},
"outputs": [],
"source": [
"class MarkeDataset(Dataset):\n",
" def __init__(self, data, root_dir, transform=transforms.ToTensor()):\n",
" self.data = data\n",
" self.root_dir = root_dir\n",
" self.transform = transform\n",
" self.device = device\n",
" \n",
" def __len__(self):\n",
" return len(self.data)\n",
" \n",
" def __getitem__(self, idx):\n",
" if torch.is_tensor(idx):\n",
" idx = idx.tolist()\n",
" \n",
" img_name = self.data.iloc[idx, 0]\n",
" image = Image.open(img_name)\n",
" y_label = torch.tensor(str_to_int[self.data.iloc[idx, 1]]).to(self.device)\n",
" \n",
" if self.transform:\n",
" image = self.transform(image).to(self.device) \n",
" \n",
" return (image, y_label)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:26.257162Z",
"iopub.status.busy": "2023-05-21T15:22:26.256652Z",
"iopub.status.idle": "2023-05-21T15:22:26.261594Z",
"shell.execute_reply": "2023-05-21T15:22:26.260674Z",
"shell.execute_reply.started": "2023-05-21T15:22:26.257103Z"
}
},
"outputs": [],
"source": [
"dataset = MarkeDataset(\n",
" data=data,\n",
" root_dir=data_dir,\n",
" transform=transform\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:29.282820Z",
"iopub.status.busy": "2023-05-21T15:22:29.282505Z",
"iopub.status.idle": "2023-05-21T15:22:30.450098Z",
"shell.execute_reply": "2023-05-21T15:22:30.449111Z",
"shell.execute_reply.started": "2023-05-21T15:22:29.282785Z"
}
},
"outputs": [],
"source": [
"randIds = np.random.randint(0,1000,size=10)\n",
"fig,ax = plt.subplots(2,5,figsize=(15,5))\n",
"for i,axi in zip(randIds,ax.flatten()):\n",
" img, lab = dataset[i]\n",
" axi.imshow(img.cpu().numpy().transpose((1, 2, 0)),cmap='gray')\n",
" axi.text(x = 150,y =2,s =f'Label :{str(lab.item())}',ha='center',backgroundcolor='y')\n",
" axi.axis('off')\n",
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:34.686493Z",
"iopub.status.busy": "2023-05-21T15:22:34.686198Z",
"iopub.status.idle": "2023-05-21T15:22:34.692454Z",
"shell.execute_reply": "2023-05-21T15:22:34.691684Z",
"shell.execute_reply.started": "2023-05-21T15:22:34.686462Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"9419"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(dataset)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:38.619412Z",
"iopub.status.busy": "2023-05-21T15:22:38.618543Z",
"iopub.status.idle": "2023-05-21T15:22:38.635127Z",
"shell.execute_reply": "2023-05-21T15:22:38.634375Z",
"shell.execute_reply.started": "2023-05-21T15:22:38.619366Z"
}
},
"outputs": [],
"source": [
"batch_size = 16\n",
"train_set, test_set = torch.utils.data.random_split(dataset, [8000,1419])\n",
"trainLoader = DataLoader(dataset=train_set,batch_size=batch_size,shuffle=True,drop_last=True)\n",
"testLoader = DataLoader(dataset=test_set,batch_size=1419)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:41.806762Z",
"iopub.status.busy": "2023-05-21T15:22:41.806452Z",
"iopub.status.idle": "2023-05-21T15:22:41.815670Z",
"shell.execute_reply": "2023-05-21T15:22:41.814797Z",
"shell.execute_reply.started": "2023-05-21T15:22:41.806729Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Metrix size after 1st conv. and maxpool layer: 149 X 149\n",
"Metrix size after 2nd conv. and maxpool layer: 73 X 73\n"
]
}
],
"source": [
"kernel_size = 5\n",
"stride = 1\n",
"padding = 1\n",
"\n",
"metrixSize1 = int(np.floor(300+2*padding-kernel_size/stride)+1)\n",
"metrixSize1 = int(np.floor(metrixSize1/2)) #applying 2x2 Max pooling operation\n",
"\n",
"metrixSize2 = int(np.floor(metrixSize1+2*padding-kernel_size/stride)+1)\n",
"metrixSize2 = int(np.floor(metrixSize2/2)) #applying 2x2 Max pooling operation\n",
"\n",
"print(f'Metrix size after 1st conv. and maxpool layer: {metrixSize1} X {metrixSize1}')\n",
"print(f'Metrix size after 2nd conv. and maxpool layer: {metrixSize2} X {metrixSize2}')"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:44.572322Z",
"iopub.status.busy": "2023-05-21T15:22:44.571998Z",
"iopub.status.idle": "2023-05-21T15:22:44.585933Z",
"shell.execute_reply": "2023-05-21T15:22:44.584795Z",
"shell.execute_reply.started": "2023-05-21T15:22:44.572285Z"
}
},
"outputs": [],
"source": [
"class theCNN(nn.Module):\n",
" def __init__(self):\n",
" super().__init__()\n",
" \n",
" self.conv01 = nn.Conv2d(\n",
" in_channels = 1,\n",
" out_channels = 10,\n",
" kernel_size = 5,\n",
" stride = 1,\n",
" padding = 1\n",
" )\n",
" \n",
" self.conv02 = nn.Conv2d(\n",
" in_channels = 10,\n",
" out_channels = 20,\n",
" kernel_size = 5,\n",
" stride = 1,\n",
" padding = 1\n",
" )\n",
" \n",
" expectedSize = np.floor((73+2*0-1)/1) +1 \n",
" expectedSize = 20*int(expectedSize**2)\n",
" \n",
" self.fc01 = nn.Linear(expectedSize,50)\n",
" self.output = nn.Linear(50,16)\n",
" \n",
" def forward(self,x):\n",
" \n",
" #convo -> maxpool -> relu\n",
" x = F.relu(F.max_pool2d(self.conv01(x),2))\n",
" \n",
" #convo -> maxpool -> relu\n",
" x = F.relu(F.max_pool2d(self.conv02(x),2))\n",
" \n",
" nUnits = x.shape.numel()/x.shape[0]\n",
" x = x.view(-1,int(nUnits))\n",
" \n",
" x = F.relu(self.fc01(x))\n",
" \n",
" return torch.softmax(self.output(x),axis=1)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:49.860090Z",
"iopub.status.busy": "2023-05-21T15:22:49.859764Z",
"iopub.status.idle": "2023-05-21T15:22:49.865939Z",
"shell.execute_reply": "2023-05-21T15:22:49.864657Z",
"shell.execute_reply.started": "2023-05-21T15:22:49.860052Z"
}
},
"outputs": [],
"source": [
"def createModel(lr):\n",
" net = theCNN()\n",
" lossFun = nn.CrossEntropyLoss()\n",
" optimizer = torch.optim.Adam(params=net.parameters(),lr=lr)\n",
" \n",
" return net,lossFun,optimizer"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:51.830628Z",
"iopub.status.busy": "2023-05-21T15:22:51.830107Z",
"iopub.status.idle": "2023-05-21T15:22:52.032717Z",
"shell.execute_reply": "2023-05-21T15:22:52.031798Z",
"shell.execute_reply.started": "2023-05-21T15:22:51.830587Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"tensor([[0.0636, 0.0599, 0.0594, 0.0579, 0.0574, 0.0701, 0.0585, 0.0668, 0.0578,\n",
" 0.0632, 0.0598, 0.0619, 0.0726, 0.0633, 0.0666, 0.0611]],\n",
" grad_fn=<SoftmaxBackward0>)"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"createModel(0.01)[0](torch.randn(1,1,300,300))"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:55.120195Z",
"iopub.status.busy": "2023-05-21T15:22:55.119083Z",
"iopub.status.idle": "2023-05-21T15:22:55.134205Z",
"shell.execute_reply": "2023-05-21T15:22:55.133312Z",
"shell.execute_reply.started": "2023-05-21T15:22:55.120083Z"
}
},
"outputs": [],
"source": [
"def trainModel(epochs,lr):\n",
" net,LossFun,optimizer = createModel(lr)\n",
" net = net.to(device)\n",
" losses = torch.zeros(epochs)\n",
" testAccuracy = torch.zeros(epochs)\n",
" trainAccurscy = torch.zeros(epochs)\n",
"\n",
" for i in range(epochs):\n",
" print(\"start\")\n",
" net.train()\n",
" batchLoss = []\n",
" batchAccuracy = []\n",
" for X,y in trainLoader:\n",
" yHat = net(X)\n",
" loss = LossFun(yHat,y)\n",
" # print(yHat.item())\n",
"\n",
" accuracy = 100*torch.mean((torch.argmax(yHat,axis=1)==y).float())\n",
" batchAccuracy.append(accuracy.item())\n",
" batchLoss.append(loss.item())\n",
"\n",
" optimizer.zero_grad()\n",
" loss.backward()\n",
" optimizer.step()\n",
"\n",
" losses[i] = np.mean(batchLoss)\n",
" trainAccurscy[i] = np.mean(batchAccuracy)\n",
"\n",
" net.eval()\n",
" X,y = next(iter(testLoader))\n",
" with torch.no_grad():\n",
" yHat = net(X)\n",
" loss = LossFun(yHat,y)\n",
" accuracy = 100*torch.mean((torch.argmax(yHat,axis=1)==y).float())\n",
" testAccuracy[i] = accuracy\n",
" print(f'Test Accuracy: {accuracy:.3f}')\n",
" \n",
" # Save the trained model\n",
" print(\"save the model\")\n",
" #torch.save(net.state_dict(), 'model.pth') \n",
" torch.save(net, \"model1.pth\")\n",
"\n",
" \n",
" return net,losses,testAccuracy,trainAccurscy,yHat,X"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-21T15:22:58.112687Z",
"iopub.status.busy": "2023-05-21T15:22:58.112351Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"start\n",
"Test Accuracy: 77.590\n",
"save the model\n",
"start\n",
"Test Accuracy: 84.003\n",
"save the model\n",
"start\n",
"Test Accuracy: 84.496\n",
"save the model\n",
"start\n",
"Test Accuracy: 85.976\n",
"save the model\n",
"start\n",
"Test Accuracy: 86.469\n",
"save the model\n",
"start\n",
"Test Accuracy: 86.610\n",
"save the model\n",
"start\n",
"Test Accuracy: 86.328\n",
"save the model\n",
"start\n",
"Test Accuracy: 86.751\n",
"save the model\n",
"start\n",
"Test Accuracy: 86.399\n",
"save the model\n",
"start\n",
"Test Accuracy: 86.681\n",
"save the model\n",
"CPU times: total: 4h 42s\n",
"Wall time: 1h 3min 31s\n"
]
}
],
"source": [
"%%time\n",
"net,losses,testAccuracy,trainAccuracy,yHat,X = trainModel(10,1e-4)\n",
"# net,losses,testAccuracy,trainAccuracy,yHat,X = trainModel(1,1e-4)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.623133Z",
"iopub.status.idle": "2023-05-21T06:28:52.624249Z",
"shell.execute_reply": "2023-05-21T06:28:52.623682Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.623638Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"import torchvision\n",
"import torchvision.transforms as transforms\n",
"from PIL import Image\n",
"from torch.utils.data import Dataset\n",
"from torch.utils.data import DataLoader\n",
"import torch.nn as nn\n",
"import torch.nn.functional as F\n",
"import os\n",
"\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import re\n",
"\n",
"plt.title(f'Final test accuracy: {testAccuracy[-1]:.3f}')\n",
"plt.plot(testAccuracy,label='Test')\n",
"plt.plot(trainAccuracy,label='Train')\n",
"plt.legend()\n",
"plt.plot()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.630115Z",
"iopub.status.idle": "2023-05-21T06:28:52.630937Z",
"shell.execute_reply": "2023-05-21T06:28:52.630583Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.630547Z"
}
},
"outputs": [],
"source": [
"plt.title(f'Final train loss: {losses[-1]:.3f}')\n",
"plt.plot(losses)\n",
"plt.plot()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.635934Z",
"iopub.status.idle": "2023-05-21T06:28:52.637341Z",
"shell.execute_reply": "2023-05-21T06:28:52.636488Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.636414Z"
}
},
"outputs": [],
"source": [
"inv_map = dict(zip(str_to_int.values(), str_to_int.keys()))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.642433Z",
"iopub.status.idle": "2023-05-21T06:28:52.643393Z",
"shell.execute_reply": "2023-05-21T06:28:52.642984Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.642964Z"
}
},
"outputs": [],
"source": [
"predictions = torch.argmax(yHat,axis=1).cpu().detach().numpy().tolist()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.646236Z",
"iopub.status.idle": "2023-05-21T06:28:52.647698Z",
"shell.execute_reply": "2023-05-21T06:28:52.647036Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.646959Z"
}
},
"outputs": [],
"source": [
"predictions = list(map(lambda x: inv_map[x],predictions))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"execution": {
"iopub.status.busy": "2023-05-21T06:28:52.653068Z",
"iopub.status.idle": "2023-05-21T06:28:52.654218Z",
"shell.execute_reply": "2023-05-21T06:28:52.653379Z",
"shell.execute_reply.started": "2023-05-21T06:28:52.653291Z"
}
},
"outputs": [],
"source": [
"randIds = np.random.randint(0,1000,size=10)\n",
"fig,ax = plt.subplots(2,5,figsize=(15,5))\n",
"for i,axi in zip(randIds,ax.flatten()):\n",
" img = X[i]\n",
" axi.imshow(img.cpu().numpy().transpose((1, 2, 0)),cmap='gray')\n",
" axi.text(x = 150,y =2,s =f'Prediction :{predictions[i]}',ha='center',backgroundcolor='y')\n",
" axi.axis('off')\n",
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Todo\n",
" - Add Dropout\n",
" - Try Image augmentation techniques"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
...@@ -41,7 +41,7 @@ export const signUp = async (req, res) => { ...@@ -41,7 +41,7 @@ export const signUp = async (req, res) => {
} = req.body; } = req.body;
try { try {
if (!type) return res.status(400).json({ code: "02", message: "Type Field Required" }) // if (!type) return res.status(400).json({ code: "02", message: "Type Field Required" })
if (!email) return res.status(400).json({ code: "02", message: "Email Field Required" }) if (!email) return res.status(400).json({ code: "02", message: "Email Field Required" })
if (!userFirstName) return res.status(400).json({ code: "02", message: "User First Name Field Required" }) if (!userFirstName) return res.status(400).json({ code: "02", message: "User First Name Field Required" })
if (!userLastName) return res.status(400).json({ code: "02", message: "User Last Name Field Required" }) if (!userLastName) return res.status(400).json({ code: "02", message: "User Last Name Field Required" })
...@@ -50,7 +50,52 @@ export const signUp = async (req, res) => { ...@@ -50,7 +50,52 @@ export const signUp = async (req, res) => {
const existingUser = await User.findOne({ email }) const existingUser = await User.findOne({ email })
if (existingUser) return res.status(400).json({ code: "02", message: "User already exists" }) if (existingUser) return res.status(400).json({ code: "02", message: "User already exists" })
if (type === "buyer") { // if (type === "buyer") {
// if (!password) return res.status(400).json({ code: "02", message: "Password Field Required" })
// if (password !== confirmPassword) return res.status(400).json({ code: "02", message: "Passwords do not match" })
// const hashedPassword = await bcrypt.hash(password, 12)
// const userDetails = new User({
// email,
// password: hashedPassword,
// type,
// userDetails: {
// userQNumber: uuidv4(),
// userEmail: email,
// userName: `${userFirstName} ${userLastName}`,
// userContactNumber,
// userAddress: `${userAddressLine1}, ${userAddressLine2}, ${userAddressLine3}`,
// userType: type,
// }
// })
// const userResult = await userDetails.save()
// const token = jwt.sign({ email: userResult.email, id: userResult._id }, 'test', { expiresIn: "1h" })
// res.status(200).json({ code: "01", result: userResult, token })
// } else if (type === "trader") {
// const userDetails = new User({
// email,
// type,
// userDetails: {
// userQNumber: uuidv4(),
// userEmail: email,
// userName: `${userFirstName} ${userLastName}`,
// userContactNumber,
// userAddress: `${userAddressLine1}, ${userAddressLine2}, ${userAddressLine3}`,
// userType: type,
// },
// states: 2
// })
// const userResult = await userDetails.save()
// const token = jwt.sign({ email: userResult.email, id: userResult._id }, 'test', { expiresIn: "1h" })
// res.status(200).json({ code: "01", result: userResult, token })
// }
if (!password) return res.status(400).json({ code: "02", message: "Password Field Required" }) if (!password) return res.status(400).json({ code: "02", message: "Password Field Required" })
if (password !== confirmPassword) return res.status(400).json({ code: "02", message: "Passwords do not match" }) if (password !== confirmPassword) return res.status(400).json({ code: "02", message: "Passwords do not match" })
const hashedPassword = await bcrypt.hash(password, 12) const hashedPassword = await bcrypt.hash(password, 12)
...@@ -65,7 +110,6 @@ export const signUp = async (req, res) => { ...@@ -65,7 +110,6 @@ export const signUp = async (req, res) => {
userName: `${userFirstName} ${userLastName}`, userName: `${userFirstName} ${userLastName}`,
userContactNumber, userContactNumber,
userAddress: `${userAddressLine1}, ${userAddressLine2}, ${userAddressLine3}`, userAddress: `${userAddressLine1}, ${userAddressLine2}, ${userAddressLine3}`,
userType: type,
} }
}) })
...@@ -74,27 +118,6 @@ export const signUp = async (req, res) => { ...@@ -74,27 +118,6 @@ export const signUp = async (req, res) => {
const token = jwt.sign({ email: userResult.email, id: userResult._id }, 'test', { expiresIn: "1h" }) const token = jwt.sign({ email: userResult.email, id: userResult._id }, 'test', { expiresIn: "1h" })
res.status(200).json({ code: "01", result: userResult, token }) res.status(200).json({ code: "01", result: userResult, token })
} else if (type === "trader") {
const userDetails = new User({
email,
type,
userDetails: {
userQNumber: uuidv4(),
userEmail: email,
userName: `${userFirstName} ${userLastName}`,
userContactNumber,
userAddress: `${userAddressLine1}, ${userAddressLine2}, ${userAddressLine3}`,
userType: type,
},
states: 2
})
const userResult = await userDetails.save()
const token = jwt.sign({ email: userResult.email, id: userResult._id }, 'test', { expiresIn: "1h" })
res.status(200).json({ code: "01", result: userResult, token })
}
} catch (error) { } catch (error) {
res.status(500).json({ code: "00", message: "Something went wrong" }) res.status(500).json({ code: "00", message: "Something went wrong" })
......
const curriculums = [
{
"curriculumCode": "01",
"curriculumLevel": "Base Level",
"curriculumName": "Learn Sign Language",
"curriculumImage": "https://drive.google.com/uc?export=view&id=1YACBlu7X-O7-DKv5DoW3AM9kgfT7Yhdc",
"tutorials": [
{
"tutorialCode": "01",
"tutorialTitle": "Numbers and Counting in Sign Language",
"tutorialImage": "https://drive.google.com/uc?export=view&id=1YACBlu7X-O7-DKv5DoW3AM9kgfT7Yhdc",
"taskItems": [
{
"title": "Learn Number One",
"description": "Learn how to sign the number one in sign language.",
"howToDo": "- Extend your index finger straight up.\n- Keep the rest of your fingers closed.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_one.jpg",
"referenceVideo": "https://example.com/number_one_video.mp4"
},
{
"title": "Learn Number Two",
"description": "Learn how to sign the number two in sign language.",
"howToDo": "- Extend your index and middle fingers straight up.\n- Keep the rest of your fingers closed.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_two.jpg",
"referenceVideo": "https://example.com/number_two_video.mp4"
},
{
"title": "Learn Number Three",
"description": "Learn how to sign the number three in sign language.",
"howToDo": "- Extend your index, middle, and ring fingers straight up.\n- Keep the rest of your fingers closed.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_three.jpg",
"referenceVideo": "https://example.com/number_three_video.mp4"
},
{
"title": "Learn Number Four",
"description": "Learn how to sign the number four in sign language.",
"howToDo": "- Extend your thumb, index, middle, and ring fingers straight up.\n- Keep your pinky finger folded.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_four.jpg",
"referenceVideo": "https://example.com/number_four_video.mp4"
},
{
"title": "Learn Number Five",
"description": "Learn how to sign the number five in sign language.",
"howToDo": "- Extend all your fingers straight up.\n- Keep your thumb resting on the side of your palm.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_five.jpg",
"referenceVideo": "https://example.com/number_five_video.mp4"
},
{
"title": "Learn Number Six",
"description": "Learn how to sign the number six in sign language.",
"howToDo": "- Extend your thumb and pinky finger straight up.\n- Keep the rest of your fingers closed.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_six.jpg",
"referenceVideo": "https://example.com/number_six_video.mp4"
},
{
"title": "Learn Number Seven",
"description": "Learn how to sign the number seven in sign language.",
"howToDo": "- Extend your index, middle, and ring fingers straight up.\n- Keep your thumb, pinky, and pinky finger folded.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_seven.jpg",
"referenceVideo": "https://example.com/number_seven_video.mp4"
},
{
"title": "Learn Number Eight",
"description": "Learn how to sign the number eight in sign language.",
"howToDo": "- Extend all your fingers straight up.\n- Cross your index and middle fingers over your ring and pinky fingers.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_eight.jpg",
"referenceVideo": "https://example.com/number_eight_video.mp4"
},
{
"title": "Learn Number Nine",
"description": "Learn how to sign the number nine in sign language.",
"howToDo": "- Extend your thumb and all your fingers straight up.\n- Keep your pinky finger folded.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_nine.jpg",
"referenceVideo": "https://example.com/number_nine_video.mp4"
},
{
"title": "Learn Number Ten",
"description": "Learn how to sign the number ten in sign language.",
"howToDo": "- Extend your thumb, index, and middle fingers straight up.\n- Keep the rest of your fingers closed.\n- Hold your hand in front of your chest.",
"referenceImage": "https://example.com/number_ten.jpg",
"referenceVideo": "https://example.com/number_ten_video.mp4"
}
]
},
{
"tutorialCode": "02",
"tutorialTitle": "Learn the Basics of Sign Language",
"tutorialImage": "https://drive.google.com/uc?export=view&id=1YACBlu7X-O7-DKv5DoW3AM9kgfT7Yhdc",
"tutorialContent": "Introduce the concept of sign language and its importance.\nTeach basic greetings and expressions, such as hello, goodbye, thank you, and sorry.\nProvide visual demonstrations and practice exercises for learners to practice these basic signs."
},
{
"tutorialCode": "03",
"tutorialTitle": "Family Signs in Sign Language",
"tutorialImage": "https://drive.google.com/uc?export=view&id=1YACBlu7X-O7-DKv5DoW3AM9kgfT7Yhdc",
"tutorialContent": "Teach signs for family members, such as mother, father, sister, brother, etc.\nIntroduce signs for common family-related words, such as family, love, and home.\nProvide visual demonstrations and practice exercises for learners to practice these family signs."
},
{
"tutorialCode": "04",
"tutorialTitle": "Everyday Vocabulary in Sign Language",
"tutorialImage": "https://drive.google.com/uc?export=view&id=1YACBlu7X-O7-DKv5DoW3AM9kgfT7Yhdc",
"tutorialContent": "Teach signs for everyday objects and activities, such as eat, drink, sleep, book, pen, etc.\nIntroduce signs for common words used in daily life.\nProvide visual demonstrations and interactive exercises for learners to practice using these signs."
},
{
"tutorialCode": "05",
"tutorialTitle": "Basic Conversational Phrases in Sign Language",
"tutorialImage": "https://drive.google.com/uc?export=view&id=1YACBlu7X-O7-DKv5DoW3AM9kgfT7Yhdc",
"tutorialContent": "Teach simple conversational phrases, such as \"What is your name?\" or \"How are you?\"\nIntroduce signs for common question words and phrases.\nProvide visual demonstrations and practice exercises for learners to practice these conversational phrases."
}
]
},
{
"curriculumCode": "02",
"curriculumLevel": "Medium Level",
"curriculumName": "Learn Sign Language",
"curriculumImage": "https://drive.google.com/uc?export=view&id=1YACBlu7X-O7-DKv5DoW3AM9kgfT7Yhdc",
"tutorials": []
},
{
"curriculumCode": "03",
"curriculumLevel": "Advance Level",
"curriculumName": "Learn Sign Language",
"curriculumImage": "https://drive.google.com/uc?export=view&id=1YACBlu7X-O7-DKv5DoW3AM9kgfT7Yhdc",
"tutorials": []
}
]
...@@ -36,6 +36,7 @@ const userSchema = mongoose.Schema({ ...@@ -36,6 +36,7 @@ const userSchema = mongoose.Schema({
}, },
userType: { userType: {
type: String, type: String,
default: "N/A",
required: true required: true
}, },
}, },
......
...@@ -5,8 +5,8 @@ import express from "express"; ...@@ -5,8 +5,8 @@ import express from "express";
import mongoose from "mongoose"; import mongoose from "mongoose";
//import routes //import routes
import userRoutes from "./routes/user.routes.js";
import translateRoutes from "./routes/translate.routes.js"; import translateRoutes from "./routes/translate.routes.js";
import userRoutes from "./routes/user.routes.js";
dotenv.config(); dotenv.config();
const app = express(); const app = express();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512" version="1.1"><path d="" stroke="none" fill="#080404" fill-rule="evenodd"/><path d="M 240.500 0.655 C 192.751 8.281, 155.481 46.800, 149.473 94.735 C 148.859 99.631, 149.012 100.166, 151.831 102.985 C 155.092 106.246, 156.921 106.645, 160.316 104.837 C 163.705 103.031, 164.739 101.025, 165.431 94.904 C 167.480 76.798, 177.669 56.294, 191.481 42.481 C 218.452 15.511, 260.448 7.930, 294.496 23.885 C 319.274 35.496, 335.922 54.504, 344.523 81 C 346.899 88.321, 347.342 91.580, 347.715 104.500 C 348.110 118.166, 347.921 120.383, 345.588 129.421 C 344.180 134.878, 341.694 142.193, 340.064 145.678 C 338.433 149.162, 324.840 171.023, 309.857 194.256 L 282.616 236.500 282.200 243.717 C 281.919 248.595, 281.285 251.349, 280.242 252.214 C 278.865 253.357, 278.767 252.634, 279.333 245.498 C 279.682 241.099, 280.663 224.675, 281.513 209 C 282.363 193.325, 283.298 178.588, 283.591 176.250 L 284.123 172 289.695 172 C 297.801 172, 302.915 170.124, 307.621 165.425 C 312.772 160.282, 314.328 155.697, 313.818 147.159 C 313.067 134.589, 304.494 126.500, 291.922 126.500 C 286.344 126.500, 284.598 126.961, 280.448 129.526 C 273.498 133.823, 270.071 139.766, 269.310 148.840 L 268.710 156 256 156 L 243.290 156 242.690 148.840 C 241.929 139.766, 238.502 133.823, 231.552 129.526 C 227.402 126.961, 225.656 126.500, 220.078 126.500 C 207.506 126.500, 198.933 134.589, 198.182 147.159 C 197.672 155.697, 199.228 160.282, 204.379 165.425 C 209.085 170.124, 214.199 172, 222.305 172 L 227.877 172 228.409 176.250 C 228.702 178.588, 229.634 193.325, 230.480 209 C 231.326 224.675, 232.289 240.875, 232.620 245 C 233.024 250.043, 232.890 252.172, 232.212 251.500 C 231.657 250.950, 231.017 247.350, 230.790 243.500 L 230.377 236.500 203.322 194.500 C 188.442 171.400, 175.132 150.250, 173.744 147.500 C 172.356 144.750, 169.988 138.548, 168.482 133.717 C 166.746 128.149, 164.977 124.397, 163.649 123.467 C 159.098 120.279, 152.858 122.732, 151.472 128.255 C 150.729 131.217, 155.214 145.457, 159.739 154.500 C 161.666 158.350, 174.888 179.605, 189.121 201.734 L 215 241.967 215 247.668 C 215 254.794, 217.986 261.327, 222.612 264.322 C 225.970 266.497, 225.975 266.513, 225.988 274.572 C 226.004 285.227, 228.096 291.196, 233.734 296.676 C 239.209 301.997, 245.435 304, 256.500 304 C 267.565 304, 273.791 301.997, 279.266 296.676 C 284.884 291.215, 286.988 285.234, 287.039 274.572 C 287.076 266.628, 287.127 266.468, 290.222 264.500 C 294.891 261.530, 298 254.893, 298 247.894 L 298 242.102 323.599 202.301 C 337.679 180.411, 350.793 159.350, 352.741 155.500 C 367.960 125.425, 367.834 88.915, 352.408 58.549 C 338.681 31.529, 313.226 11.075, 283.190 2.931 C 277.284 1.330, 271.787 0.768, 259.500 0.511 C 250.700 0.327, 242.150 0.392, 240.500 0.655 M 105.315 28.007 C 102.579 29.110, 101 31.985, 101 35.865 C 101 38.405, 102.554 40.244, 111.195 47.931 C 120.171 55.916, 121.836 57, 125.122 57 C 127.964 57, 129.350 56.371, 130.927 54.365 C 135.282 48.830, 133.296 45.630, 117.198 32.241 C 110.841 26.954, 109.296 26.403, 105.315 28.007 M 395.913 32.149 C 379.693 45.639, 377.711 48.820, 382.073 54.365 C 383.650 56.371, 385.036 57, 387.878 57 C 391.164 57, 392.829 55.916, 401.805 47.931 C 410.864 39.873, 412 38.492, 412 35.542 C 412 31.374, 409.415 28.182, 405.413 27.411 C 402.742 26.895, 401.463 27.533, 395.913 32.149 M 115.896 94.166 C 103.435 104.537, 101 107.330, 101 111.256 C 101 113.953, 101.660 115.374, 103.635 116.927 C 108.707 120.917, 112.119 119.289, 125.750 106.369 C 133.914 98.630, 134.841 95.750, 130.545 91.455 C 126.624 87.533, 123.077 88.190, 115.896 94.166 M 382.455 91.455 C 378.318 95.591, 379.147 98.635, 386.250 105.396 C 395.563 114.261, 401.905 119, 404.455 119 C 408.419 119, 412 115.325, 412 111.256 C 412 107.330, 409.565 104.537, 397.104 94.166 C 389.923 88.190, 386.376 87.533, 382.455 91.455 M 215.073 144.635 C 212.709 147.640, 212.519 149.218, 214.150 152.316 C 215.804 155.458, 216.929 155.968, 222.250 155.985 L 227 156 227 151.635 C 227 146.062, 224.049 142, 220 142 C 218.107 142, 216.447 142.888, 215.073 144.635 M 287.219 144.267 C 285.579 146.013, 285 147.851, 285 151.314 L 285 156 289.929 156 C 295.307 156, 297.580 154.522, 298.629 150.343 C 300.190 144.121, 291.635 139.566, 287.219 144.267 M 79.990 170.250 C 75.163 173.535, 72.848 177.169, 72.260 182.386 L 71.740 187 53.518 187 C 36.267 187, 35.120 187.120, 31.990 189.250 C 30.172 190.488, 27.743 192.771, 26.592 194.323 L 24.500 197.147 24.500 337.323 L 24.500 477.500 28.215 485.280 C 33.155 495.625, 40.375 502.845, 50.720 507.785 L 58.500 511.500 256 511.500 L 453.500 511.500 461.280 507.785 C 474.557 501.445, 483.994 489.753, 486.935 476 C 487.813 471.896, 488.034 435.820, 487.806 333.823 L 487.500 197.146 485.408 194.323 C 484.257 192.770, 481.828 190.488, 480.010 189.250 C 476.889 187.126, 475.714 187, 458.982 187 L 441.260 187 440.740 182.386 C 440.152 177.169, 437.837 173.535, 433.010 170.250 C 429.741 168.025, 429.328 168, 395.425 168 L 361.145 168 359.073 170.635 C 357.933 172.084, 357 174.273, 357 175.500 C 357 176.727, 357.933 178.916, 359.073 180.365 L 361.145 183 393.045 183 L 424.944 183 425.222 231.089 L 425.500 279.178 427.861 281.089 C 430.876 283.529, 435.124 283.530, 438.139 281.089 L 440.500 279.178 440.784 240.589 L 441.068 202 456.548 202 L 472.028 202 471.764 338.750 L 471.500 475.500 469.348 479.500 C 466.204 485.344, 460.266 490.911, 454 493.887 L 448.500 496.500 256 496.500 L 63.500 496.500 58 493.887 C 51.734 490.911, 45.796 485.344, 42.652 479.500 L 40.500 475.500 40.236 338.750 L 39.972 202 55.986 202 L 72 202 72.022 332.250 C 72.043 456.897, 72.124 462.672, 73.896 466.500 C 76.051 471.156, 80.313 475.424, 84.315 476.936 C 88.269 478.430, 424.731 478.430, 428.685 476.936 C 432.687 475.424, 436.949 471.156, 439.104 466.500 C 440.856 462.716, 440.957 458.283, 440.978 384.297 C 440.994 328.262, 440.680 305.391, 439.870 303.615 C 437.340 298.061, 428.660 298.061, 426.130 303.615 C 425.334 305.360, 425 322.207, 425 360.547 L 425 415 360.894 415 C 305.856 415, 295.931 415.222, 290.724 416.571 C 283.019 418.568, 274.632 422.794, 268.946 427.546 L 264.500 431.261 264 381.380 C 263.725 353.946, 263.163 330.982, 262.752 330.348 C 261.249 328.035, 256.532 327.157, 253.180 328.566 C 251.431 329.302, 249.898 330.038, 249.773 330.202 C 249.648 330.366, 249.311 353.171, 249.023 380.880 L 248.500 431.261 244.054 427.546 C 241.609 425.503, 237.073 422.551, 233.975 420.987 C 223.702 415.801, 218.359 415, 194.060 415 L 171.909 415 169.455 417.455 C 166.346 420.563, 166.332 424.111, 169.411 427.694 L 171.823 430.500 195.687 431 L 219.552 431.500 226.131 434.741 C 236.236 439.720, 244.091 449.293, 247.471 460.750 L 248.135 463 170.002 463 C 118.055 463, 91.220 462.653, 89.934 461.965 C 88.155 461.012, 88 459.737, 88 446.008 L 88 431.087 117.088 430.793 L 146.176 430.500 148.680 427.587 C 151.635 424.150, 151.301 419.585, 147.886 416.750 C 145.986 415.172, 142.933 415, 116.889 415 L 88 415 88 299 L 88 183 119.927 183 L 151.855 183 153.927 180.365 C 155.067 178.916, 156 176.727, 156 175.500 C 156 174.273, 155.067 172.084, 153.927 170.635 L 151.855 168 117.575 168 C 83.672 168, 83.259 168.025, 79.990 170.250 M 244.459 178.750 C 244.778 182.463, 245.699 197.425, 246.505 212 C 247.312 226.575, 248.241 241.762, 248.571 245.750 L 249.171 253 256 253 L 262.829 253 263.429 245.750 C 263.759 241.762, 264.688 226.575, 265.495 212 C 266.301 197.425, 267.222 182.463, 267.541 178.750 L 268.121 172 256 172 L 243.879 172 244.459 178.750 M 103 255 C 101.762 256.238, 101 258.333, 101 260.500 C 101 262.667, 101.762 264.762, 103 266 C 104.934 267.934, 106.333 268, 145.500 268 C 184.667 268, 186.066 267.934, 188 266 C 190.652 263.348, 190.652 257.652, 188 255 C 186.066 253.066, 184.667 253, 145.500 253 C 106.333 253, 104.934 253.066, 103 255 M 325 255 C 323.762 256.238, 323 258.333, 323 260.500 C 323 262.667, 323.762 264.762, 325 266 C 326.934 267.934, 328.333 268, 367.500 268 C 406.667 268, 408.066 267.934, 410 266 C 411.238 264.762, 412 262.667, 412 260.500 C 412 258.333, 411.238 256.238, 410 255 C 408.066 253.066, 406.667 253, 367.500 253 C 328.333 253, 326.934 253.066, 325 255 M 242 275.077 C 242 281.565, 242.243 282.397, 244.923 285.077 C 247.703 287.857, 248.269 288, 256.500 288 C 264.731 288, 265.297 287.857, 268.077 285.077 C 270.757 282.397, 271 281.565, 271 275.077 L 271 268 256.500 268 L 242 268 242 275.077 M 117.114 292.750 C 113.699 295.585, 113.365 300.150, 116.320 303.587 L 118.825 306.500 161.663 306.788 C 185.223 306.947, 205.524 306.823, 206.775 306.513 C 212.872 305.002, 215.119 297.339, 210.686 293.174 C 208.381 291.009, 208.186 291, 163.796 291 C 122.814 291, 119.052 291.141, 117.114 292.750 M 302.174 293.314 C 298.007 297.751, 300.240 305.030, 306.225 306.513 C 307.476 306.823, 327.777 306.947, 351.337 306.788 L 394.175 306.500 396.680 303.587 C 399.635 300.150, 399.301 295.585, 395.886 292.750 C 393.948 291.141, 390.180 291, 349.064 291 L 304.349 291 302.174 293.314 M 119.308 328.010 C 115.886 329.388, 113.714 333.422, 114.491 336.958 C 115.840 343.099, 115.029 343, 164.048 343 L 208.651 343 210.826 340.686 C 214.814 336.441, 213.301 329.998, 207.872 328.105 C 204.009 326.758, 122.633 326.671, 119.308 328.010 M 304.400 328.412 C 299.382 330.622, 298.301 337.055, 302.314 340.826 C 304.619 342.991, 304.814 343, 349.204 343 C 390.186 343, 393.948 342.859, 395.886 341.250 C 399.301 338.415, 399.635 333.850, 396.680 330.413 L 394.175 327.500 350.837 327.273 C 316.003 327.090, 306.892 327.314, 304.400 328.412 M 117.201 366.028 C 112.920 370.016, 113.426 375.268, 118.406 378.531 C 120.431 379.857, 126.626 380.024, 164.960 379.781 L 209.178 379.500 211.089 377.139 C 213.917 373.645, 213.588 368.607, 210.365 366.073 C 207.790 364.047, 206.732 364, 163.554 364 C 120.558 364, 119.319 364.054, 117.201 366.028 M 302.635 366.073 C 299.096 368.856, 299.014 374.104, 302.455 377.545 L 304.909 380 349.031 380 L 393.154 380 396.077 377.077 C 399.248 373.906, 399.635 372.061, 397.837 368.684 C 395.350 364.015, 395.874 364.065, 349.385 364.032 C 306.244 364.001, 305.212 364.046, 302.635 366.073 M 292.286 432.451 C 279.717 436.379, 269.545 447.137, 265.529 460.750 L 264.865 463 342.998 463 C 394.945 463, 421.780 462.653, 423.066 461.965 C 424.846 461.012, 425 459.737, 425 445.965 L 425 431 360.750 431.067 C 310.560 431.119, 295.578 431.422, 292.286 432.451" stroke="none" fill="#040404" fill-rule="evenodd"/></svg>
\ No newline at end of file
{ {
"name": "React Material Minimal UI", "name": "React Material SignConnect+",
"short_name": "Minimal-UI", "short_name": "Minimal-UI",
"display": "standalone", "display": "standalone",
"start_url": "/", "start_url": "/",
......
...@@ -17,7 +17,7 @@ import MegaMenuCarousel from './MenuCarousel'; ...@@ -17,7 +17,7 @@ import MegaMenuCarousel from './MenuCarousel';
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
const MENU_PAPER_WIDTH = 800; const MENU_PAPER_WIDTH = 800;
const PARENT_ITEM_HEIGHT = 40; const PARENT_ITEM_HEIGHT = 60;
type Props = { type Props = {
data: MegaMenuItemProps[]; data: MegaMenuItemProps[];
......
...@@ -2,20 +2,18 @@ import { useEffect } from 'react'; ...@@ -2,20 +2,18 @@ import { useEffect } from 'react';
// next // next
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
// @mui // @mui
import { Box, Stack, Drawer, Button } from '@mui/material'; import { Box, Button, Drawer, Stack } from '@mui/material';
// hooks // hooks
import useResponsive from '../../../hooks/useResponsive'; import useResponsive from '../../../hooks/useResponsive';
// config // config
import { NAV } from '../../../config'; import { NAV } from '../../../config';
// components // components
import Logo from '../../../components/logo';
import Scrollbar from '../../../components/scrollbar';
import { NavSectionVertical } from '../../../components/nav-section'; import { NavSectionVertical } from '../../../components/nav-section';
import Scrollbar from '../../../components/scrollbar';
// //
import navConfig from './config';
import NavDocs from './NavDocs';
import NavAccount from './NavAccount';
import { useSettingsContext } from 'src/components/settings'; import { useSettingsContext } from 'src/components/settings';
import NavAccount from './NavAccount';
import navConfig from './config';
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
...@@ -38,12 +36,12 @@ export default function NavVertical({ openNav, onCloseNav }: Props) { ...@@ -38,12 +36,12 @@ export default function NavVertical({ openNav, onCloseNav }: Props) {
value: 'mini' value: 'mini'
} }
} as React.ChangeEvent<HTMLInputElement>) } as React.ChangeEvent<HTMLInputElement>)
}else { } else {
onChangeLayout({ onChangeLayout({
target: { target: {
value: 'vertical' value: 'vertical'
} }
} as React.ChangeEvent<HTMLInputElement> ) } as React.ChangeEvent<HTMLInputElement>)
} }
} }
...@@ -75,7 +73,7 @@ export default function NavVertical({ openNav, onCloseNav }: Props) { ...@@ -75,7 +73,7 @@ export default function NavVertical({ openNav, onCloseNav }: Props) {
}} }}
> >
<Button onClick={onClickHan}>Change Layout</Button> <Button onClick={onClickHan}>Change Layout</Button>
{/* <Logo /> */} {/* <Logo /> */}
<NavAccount /> <NavAccount />
...@@ -85,7 +83,6 @@ export default function NavVertical({ openNav, onCloseNav }: Props) { ...@@ -85,7 +83,6 @@ export default function NavVertical({ openNav, onCloseNav }: Props) {
<Box sx={{ flexGrow: 1 }} /> <Box sx={{ flexGrow: 1 }} />
<NavDocs />
</Scrollbar> </Scrollbar>
); );
......
// routes // routes
import { PATH_DASHBOARD } from '../../../routes/paths'; import { PATH_DASHBOARD } from '../../../routes/paths';
// components // components
import Label from '../../../components/label';
import Iconify from '../../../components/iconify';
import SvgColor from '../../../components/svg-color'; import SvgColor from '../../../components/svg-color';
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
...@@ -33,206 +31,40 @@ const ICONS = { ...@@ -33,206 +31,40 @@ const ICONS = {
ecommerce: icon('ic_ecommerce'), ecommerce: icon('ic_ecommerce'),
analytics: icon('ic_analytics'), analytics: icon('ic_analytics'),
dashboard: icon('ic_dashboard'), dashboard: icon('ic_dashboard'),
learning: icon('ic_learning')
}; };
const navConfig = [ const navConfig = [
// GENERAL // GENERAL
// ----------------------------------------------------------------------
{ {
subheader: 'general', subheader: 'general',
items: [ items: [
{ title: 'app', path: PATH_DASHBOARD.general.app, icon: ICONS.dashboard }, { title: 'app', path: PATH_DASHBOARD.general.app, icon: ICONS.dashboard },
{ title: 'ecommerce', path: PATH_DASHBOARD.general.ecommerce, icon: ICONS.ecommerce }, { title: 'blank', path: PATH_DASHBOARD.blank, icon: ICONS.blank },
{ title: 'analytics', path: PATH_DASHBOARD.general.analytics, icon: ICONS.analytics }, //Spoken language to Sign Language Module items
{ title: 'banking', path: PATH_DASHBOARD.general.banking, icon: ICONS.banking },
{ title: 'booking', path: PATH_DASHBOARD.general.booking, icon: ICONS.booking },
{ title: 'file', path: PATH_DASHBOARD.general.file, icon: ICONS.file },
],
},
// MANAGEMENT
// ----------------------------------------------------------------------
{
subheader: 'management',
items: [
// USER
{
title: 'user',
path: PATH_DASHBOARD.user.root,
icon: ICONS.user,
children: [
{ title: 'profile', path: PATH_DASHBOARD.user.profile },
{ title: 'cards', path: PATH_DASHBOARD.user.cards },
{ title: 'list', path: PATH_DASHBOARD.user.list },
{ title: 'create', path: PATH_DASHBOARD.user.new },
{ title: 'edit', path: PATH_DASHBOARD.user.demoEdit },
{ title: 'account', path: PATH_DASHBOARD.user.account },
],
},
// E-COMMERCE
{ {
title: 'ecommerce', title: 'Spoken language Translation Module',
path: PATH_DASHBOARD.eCommerce.root, path: PATH_DASHBOARD.spokenLanguageTranslationModule.root,
icon: ICONS.cart,
children: [
{ title: 'shop', path: PATH_DASHBOARD.eCommerce.shop },
{ title: 'product', path: PATH_DASHBOARD.eCommerce.demoView },
{ title: 'list', path: PATH_DASHBOARD.eCommerce.list },
{ title: 'create', path: PATH_DASHBOARD.eCommerce.new },
{ title: 'edit', path: PATH_DASHBOARD.eCommerce.demoEdit },
{ title: 'checkout', path: PATH_DASHBOARD.eCommerce.checkout },
],
},
// INVOICE
{
title: 'invoice',
path: PATH_DASHBOARD.invoice.root,
icon: ICONS.invoice,
children: [
{ title: 'list', path: PATH_DASHBOARD.invoice.list },
{ title: 'details', path: PATH_DASHBOARD.invoice.demoView },
{ title: 'create', path: PATH_DASHBOARD.invoice.new },
{ title: 'edit', path: PATH_DASHBOARD.invoice.demoEdit },
],
},
// BLOG
{
title: 'blog',
path: PATH_DASHBOARD.blog.root,
icon: ICONS.blog,
children: [
{ title: 'posts', path: PATH_DASHBOARD.blog.posts },
{ title: 'post', path: PATH_DASHBOARD.blog.demoView },
{ title: 'create', path: PATH_DASHBOARD.blog.new },
],
},
{
title: 'File manager',
path: PATH_DASHBOARD.fileManager,
icon: ICONS.folder,
},
],
},
// APP
// ----------------------------------------------------------------------
{
subheader: 'app',
items: [
{
title: 'mail',
path: PATH_DASHBOARD.mail.root,
icon: ICONS.mail,
info: <Label color="error">+32</Label>,
},
{
title: 'chat',
path: PATH_DASHBOARD.chat.root,
icon: ICONS.chat, icon: ICONS.chat,
},
{
title: 'calendar',
path: PATH_DASHBOARD.calendar,
icon: ICONS.calendar,
},
{
title: 'kanban',
path: PATH_DASHBOARD.kanban,
icon: ICONS.kanban,
},
],
},
// DEMO MENU STATES
{
subheader: 'Other cases',
items: [
{
// default roles : All roles can see this entry.
// roles: ['user'] Only users can see this item.
// roles: ['admin'] Only admin can see this item.
// roles: ['admin', 'manager'] Only admin/manager can see this item.
// Reference from 'src/guards/RoleBasedGuard'.
title: 'item_by_roles',
path: PATH_DASHBOARD.permissionDenied,
icon: ICONS.lock,
roles: ['admin'],
caption: 'only_admin_can_see_this_item',
},
{
title: 'menu_level',
path: '#/dashboard/menu_level',
icon: ICONS.menuItem,
children: [ children: [
{ { title: 'Home', path: PATH_DASHBOARD.spokenLanguageTranslationModule.spokenLanguageTranslationHome },
title: 'menu_level_2a', ],
path: '#/dashboard/menu_level/menu_level_2a',
},
{
title: 'menu_level_2b',
path: '#/dashboard/menu_level/menu_level_2b',
children: [
{
title: 'menu_level_3a',
path: '#/dashboard/menu_level/menu_level_2b/menu_level_3a',
}, },
// Sign Language Learning Module items
{ {
title: 'menu_level_3b', title: 'Learning Module',
path: '#/dashboard/menu_level/menu_level_2b/menu_level_3b', path: PATH_DASHBOARD.learningModule.root,
icon: ICONS.learning,
children: [ children: [
{ { title: 'Curriculum', path: PATH_DASHBOARD.learningModule.curriculumHome },
title: 'menu_level_4a', { title: 'Question and Answers', path: PATH_DASHBOARD.learningModule.questionAndAnswersHome },
path: '#/dashboard/menu_level/menu_level_2b/menu_level_3b/menu_level_4a', { title: 'Lead Board', path: PATH_DASHBOARD.learningModule.leadBoardHome },
}, { title: 'Feedback', path: PATH_DASHBOARD.learningModule.feedbackHome },
{
title: 'menu_level_4b',
path: '#/dashboard/menu_level/menu_level_2b/menu_level_3b/menu_level_4b',
},
],
},
], ],
}, },
], ],
}, },
{
title: 'item_disabled',
path: '#disabled',
icon: ICONS.disabled,
disabled: true,
},
{
title: 'item_label',
path: '#label',
icon: ICONS.label,
info: (
<Label color="info" startIcon={<Iconify icon="eva:email-fill" />}>
NEW
</Label>
),
},
{
title: 'item_caption',
path: '#caption',
icon: ICONS.menuItem,
caption:
'Quisque malesuada placerat nisl. In hac habitasse platea dictumst. Cras id dui. Pellentesque commodo eros a enim. Morbi mollis tellus ac sapien.',
},
{
title: 'item_external_link',
path: 'https://www.google.com/',
icon: ICONS.external,
},
{
title: 'blank',
path: PATH_DASHBOARD.blank,
icon: ICONS.blank,
},
],
},
]; ];
export default navConfig; export default navConfig;
...@@ -97,7 +97,7 @@ export default function Footer() { ...@@ -97,7 +97,7 @@ export default function Footer() {
<Grid item xs={8} md={3}> <Grid item xs={8} md={3}>
<Typography variant="body2" sx={{ pr: { md: 5 } }}> <Typography variant="body2" sx={{ pr: { md: 5 } }}>
The starting point for your next project with Minimal UI Kit, built on the newest The starting point for your next project with SignConnect+ Kit, built on the newest
version of Material-UI ©, ready to be customized to your style. version of Material-UI ©, ready to be customized to your style.
</Typography> </Typography>
......
...@@ -21,7 +21,7 @@ export default function Page403() { ...@@ -21,7 +21,7 @@ export default function Page403() {
return ( return (
<> <>
<Head> <Head>
<title> 403 Forbidden | Minimal UI</title> <title> 403 Forbidden | SignConnect+</title>
</Head> </Head>
<MotionContainer> <MotionContainer>
......
...@@ -21,7 +21,7 @@ export default function Page404() { ...@@ -21,7 +21,7 @@ export default function Page404() {
return ( return (
<> <>
<Head> <Head>
<title> 404 Page Not Found | Minimal UI</title> <title> 404 Page Not Found | SignConnect+</title>
</Head> </Head>
<MotionContainer> <MotionContainer>
......
...@@ -21,7 +21,7 @@ export default function Page500() { ...@@ -21,7 +21,7 @@ export default function Page500() {
return ( return (
<> <>
<Head> <Head>
<title> 500 Internal Server Error | Minimal UI</title> <title> 500 Internal Server Error | SignConnect+</title>
</Head> </Head>
<MotionContainer> <MotionContainer>
......
...@@ -45,10 +45,10 @@ export default class MyDocument extends Document { ...@@ -45,10 +45,10 @@ export default class MyDocument extends Document {
{/* Meta */} {/* Meta */}
<meta <meta
name="description" name="description"
content="The starting point for your next project with Minimal UI Kit, built on the newest version of Material-UI ©, ready to be customized to your style" content="The starting point for your next project with SignConnect+ Kit, built on the newest version of Material-UI ©, ready to be customized to your style"
/> />
<meta name="keywords" content="react,material,kit,application,dashboard,admin,template" /> <meta name="keywords" content="react,material,kit,application,dashboard,admin,template" />
<meta name="author" content="Minimal UI Kit" /> <meta name="author" content="SignConnect+ Kit" />
</Head> </Head>
<body> <body>
......
...@@ -17,7 +17,7 @@ export default function AboutPage() { ...@@ -17,7 +17,7 @@ export default function AboutPage() {
return ( return (
<> <>
<Head> <Head>
<title> About us | Minimal UI</title> <title> About us | SignConnect+</title>
</Head> </Head>
<AboutHero /> <AboutHero />
......
...@@ -9,7 +9,7 @@ export default function LoginUnprotectedPage() { ...@@ -9,7 +9,7 @@ export default function LoginUnprotectedPage() {
return ( return (
<> <>
<Head> <Head>
<title> Login Unprotected | Minimal UI</title> <title> Login Unprotected | SignConnect+</title>
</Head> </Head>
<Login /> <Login />
......
...@@ -12,7 +12,7 @@ export default function LoginPage() { ...@@ -12,7 +12,7 @@ export default function LoginPage() {
return ( return (
<> <>
<Head> <Head>
<title> Login | Minimal UI</title> <title> Login | SignConnect+</title>
</Head> </Head>
<GuestGuard> <GuestGuard>
......
...@@ -24,7 +24,7 @@ export default function NewPasswordPage() { ...@@ -24,7 +24,7 @@ export default function NewPasswordPage() {
return ( return (
<> <>
<Head> <Head>
<title> New Password | Minimal UI</title> <title> New Password | SignConnect+</title>
</Head> </Head>
<SentIcon sx={{ mb: 5, height: 96 }} /> <SentIcon sx={{ mb: 5, height: 96 }} />
......
...@@ -9,7 +9,7 @@ export default function RegisterUnprotectedPage() { ...@@ -9,7 +9,7 @@ export default function RegisterUnprotectedPage() {
return ( return (
<> <>
<Head> <Head>
<title> Register Unprotected | Minimal UI</title> <title> Register Unprotected | SignConnect+</title>
</Head> </Head>
<Register /> <Register />
......
// next // next
import Head from 'next/head'; import Head from 'next/head';
// auth // auth
import GuestGuard from '../../auth/GuestGuard';
// sections // sections
import Register from '../../sections/auth/Register'; import Register from '../../sections/auth/Register';
...@@ -11,12 +10,10 @@ export default function RegisterPage() { ...@@ -11,12 +10,10 @@ export default function RegisterPage() {
return ( return (
<> <>
<Head> <Head>
<title> Register | Minimal UI</title> <title> Register | SignConnect+</title>
</Head> </Head>
<GuestGuard>
<Register /> <Register />
</GuestGuard>
</> </>
); );
} }
...@@ -24,7 +24,7 @@ export default function ResetPasswordPage() { ...@@ -24,7 +24,7 @@ export default function ResetPasswordPage() {
return ( return (
<> <>
<Head> <Head>
<title> Reset Password | Minimal UI</title> <title> Reset Password | SignConnect+</title>
</Head> </Head>
<PasswordIcon sx={{ mb: 5, height: 96 }} /> <PasswordIcon sx={{ mb: 5, height: 96 }} />
......
...@@ -24,7 +24,7 @@ export default function VerifyCodePage() { ...@@ -24,7 +24,7 @@ export default function VerifyCodePage() {
return ( return (
<> <>
<Head> <Head>
<title> Verify Code | Minimal UI</title> <title> Verify Code | SignConnect+</title>
</Head> </Head>
<EmailInboxIcon sx={{ mb: 5, height: 96 }} /> <EmailInboxIcon sx={{ mb: 5, height: 96 }} />
......
...@@ -27,7 +27,7 @@ export default function ComingSoonPage() { ...@@ -27,7 +27,7 @@ export default function ComingSoonPage() {
return ( return (
<> <>
<Head> <Head>
<title> Coming Soon | Minimal UI</title> <title> Coming Soon | SignConnect+</title>
</Head> </Head>
<Typography variant="h3" paragraph> <Typography variant="h3" paragraph>
......
...@@ -40,7 +40,7 @@ export default function DemoAnimatePage() { ...@@ -40,7 +40,7 @@ export default function DemoAnimatePage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Animate | Minimal UI</title> <title> Extra Components: Animate | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -41,7 +41,7 @@ export default function DemoCarouselsPage() { ...@@ -41,7 +41,7 @@ export default function DemoCarouselsPage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Carousels | Minimal UI</title> <title> Extra Components: Carousels | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -34,7 +34,7 @@ export default function DemoChartsPage() { ...@@ -34,7 +34,7 @@ export default function DemoChartsPage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Charts | Minimal UI</title> <title> Extra Components: Charts | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -65,7 +65,7 @@ export default function DemoCopyToClipboardPage() { ...@@ -65,7 +65,7 @@ export default function DemoCopyToClipboardPage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Copy To Clipboard | Minimal UI</title> <title> Extra Components: Copy To Clipboard | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -35,7 +35,7 @@ export default function DemoEditorPage() { ...@@ -35,7 +35,7 @@ export default function DemoEditorPage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Editor | Minimal UI</title> <title> Extra Components: Editor | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -21,7 +21,7 @@ export default function DemoFormValidationPage() { ...@@ -21,7 +21,7 @@ export default function DemoFormValidationPage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Form Validation | Minimal UI</title> <title> Extra Components: Form Validation | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -29,7 +29,7 @@ export default function DemoImagePage() { ...@@ -29,7 +29,7 @@ export default function DemoImagePage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Image | Minimal UI</title> <title> Extra Components: Image | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -26,7 +26,7 @@ export default function DemoLabelPage() { ...@@ -26,7 +26,7 @@ export default function DemoLabelPage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Label | Minimal UI</title> <title> Extra Components: Label | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -42,7 +42,7 @@ export default function DemoLightboxPage() { ...@@ -42,7 +42,7 @@ export default function DemoLightboxPage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Lightbox | Minimal UI</title> <title> Extra Components: Lightbox | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -74,7 +74,7 @@ export default function DemoMapPage() { ...@@ -74,7 +74,7 @@ export default function DemoMapPage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Map | Minimal UI</title> <title> Extra Components: Map | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -30,7 +30,7 @@ export default function DemoMegaMenuPage() { ...@@ -30,7 +30,7 @@ export default function DemoMegaMenuPage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Mega Menu | Minimal UI</title> <title> Extra Components: Mega Menu | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -60,7 +60,7 @@ export default function DemoMultiLanguagePage() { ...@@ -60,7 +60,7 @@ export default function DemoMultiLanguagePage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Multi Language | Minimal UI</title> <title> Extra Components: Multi Language | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -27,7 +27,7 @@ export default function DemoNavigationBarPage() { ...@@ -27,7 +27,7 @@ export default function DemoNavigationBarPage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Navigation Bar | Minimal UI</title> <title> Extra Components: Navigation Bar | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -29,7 +29,7 @@ export default function DemoOrganizationalChartPage() { ...@@ -29,7 +29,7 @@ export default function DemoOrganizationalChartPage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Organizational Chart | Minimal UI</title> <title> Extra Components: Organizational Chart | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -20,7 +20,7 @@ export default function DemoScrollbarPage() { ...@@ -20,7 +20,7 @@ export default function DemoScrollbarPage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Scrollbar | Minimal UI</title> <title> Extra Components: Scrollbar | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -59,7 +59,7 @@ export default function DemoSnackbarPage() { ...@@ -59,7 +59,7 @@ export default function DemoSnackbarPage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Snackbar | Minimal UI</title> <title> Extra Components: Snackbar | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -21,7 +21,7 @@ export default function DemoTextMaxLinePage() { ...@@ -21,7 +21,7 @@ export default function DemoTextMaxLinePage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Text Max Line | Minimal UI</title> <title> Extra Components: Text Max Line | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -87,7 +87,7 @@ export default function DemoUploadPage() { ...@@ -87,7 +87,7 @@ export default function DemoUploadPage() {
return ( return (
<> <>
<Head> <Head>
<title> Extra Components: Upload | Minimal UI</title> <title> Extra Components: Upload | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -54,7 +54,7 @@ export default function FoundationColorsPage() { ...@@ -54,7 +54,7 @@ export default function FoundationColorsPage() {
return ( return (
<> <>
<Head> <Head>
<title> Foundations: Colors | Minimal UI</title> <title> Foundations: Colors | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -60,7 +60,7 @@ export default function FoundationGridPage() { ...@@ -60,7 +60,7 @@ export default function FoundationGridPage() {
return ( return (
<> <>
<Head> <Head>
<title> Foundations: Grid | Minimal UI</title> <title> Foundations: Grid | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -33,7 +33,7 @@ export default function FoundationIconsPage() { ...@@ -33,7 +33,7 @@ export default function FoundationIconsPage() {
return ( return (
<> <>
<Head> <Head>
<title> Foundations: Icons | Minimal UI</title> <title> Foundations: Icons | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -51,7 +51,7 @@ export default function FoundationShadowsPage() { ...@@ -51,7 +51,7 @@ export default function FoundationShadowsPage() {
return ( return (
<> <>
<Head> <Head>
<title> Foundations: Shadows | Minimal UI</title> <title> Foundations: Shadows | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -55,7 +55,7 @@ export default function FoundationTypographyPage() { ...@@ -55,7 +55,7 @@ export default function FoundationTypographyPage() {
return ( return (
<> <>
<Head> <Head>
<title> Foundations: Typography | Minimal UI</title> <title> Foundations: Typography | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -19,7 +19,7 @@ export default function ComponentsOverviewPage() { ...@@ -19,7 +19,7 @@ export default function ComponentsOverviewPage() {
return ( return (
<> <>
<Head> <Head>
<title> Components Overview | Minimal UI</title> <title> Components Overview | SignConnect+</title>
</Head> </Head>
<ComponentHero /> <ComponentHero />
......
...@@ -50,7 +50,7 @@ export default function MUIAccordionPage() { ...@@ -50,7 +50,7 @@ export default function MUIAccordionPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Accordion | Minimal UI</title> <title> MUI Components: Accordion | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -36,7 +36,7 @@ export default function MUIAlertPage() { ...@@ -36,7 +36,7 @@ export default function MUIAlertPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Alert | Minimal UI</title> <title> MUI Components: Alert | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -47,7 +47,7 @@ export default function MUIAutocompletePage() { ...@@ -47,7 +47,7 @@ export default function MUIAutocompletePage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Autocomplete | Minimal UI</title> <title> MUI Components: Autocomplete | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -40,7 +40,7 @@ export default function MUIAvatarPage() { ...@@ -40,7 +40,7 @@ export default function MUIAvatarPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Avatar | Minimal UI</title> <title> MUI Components: Avatar | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -23,7 +23,7 @@ export default function MUIBadgePage() { ...@@ -23,7 +23,7 @@ export default function MUIBadgePage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Badge | Minimal UI</title> <title> MUI Components: Badge | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -22,7 +22,7 @@ export default function MUIBreadcrumbsPage() { ...@@ -22,7 +22,7 @@ export default function MUIBreadcrumbsPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Breadcrumbs | Minimal UI</title> <title> MUI Components: Breadcrumbs | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -49,7 +49,7 @@ export default function MUIButtonsPage() { ...@@ -49,7 +49,7 @@ export default function MUIButtonsPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Buttons | Minimal UI</title> <title> MUI Components: Buttons | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -52,7 +52,7 @@ export default function MUICheckboxPage() { ...@@ -52,7 +52,7 @@ export default function MUICheckboxPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Checkbox | Minimal UI</title> <title> MUI Components: Checkbox | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -21,7 +21,7 @@ export default function MUIChipPage() { ...@@ -21,7 +21,7 @@ export default function MUIChipPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Chip | Minimal UI</title> <title> MUI Components: Chip | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -40,7 +40,7 @@ export default function MUIDataGridPage() { ...@@ -40,7 +40,7 @@ export default function MUIDataGridPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: DataGrid | Minimal UI</title> <title> MUI Components: DataGrid | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -37,7 +37,7 @@ export default function MUIDialogPage() { ...@@ -37,7 +37,7 @@ export default function MUIDialogPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Dialog | Minimal UI</title> <title> MUI Components: Dialog | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -97,7 +97,7 @@ export default function MUIListPage() { ...@@ -97,7 +97,7 @@ export default function MUIListPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: List | Minimal UI</title> <title> MUI Components: List | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -98,7 +98,7 @@ export default function MUIMenuPage() { ...@@ -98,7 +98,7 @@ export default function MUIMenuPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Menu | Minimal UI</title> <title> MUI Components: Menu | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -60,7 +60,7 @@ export default function MUIPaginationPage() { ...@@ -60,7 +60,7 @@ export default function MUIPaginationPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Pagination | Minimal UI</title> <title> MUI Components: Pagination | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -36,7 +36,7 @@ export default function MUIPickersPage() { ...@@ -36,7 +36,7 @@ export default function MUIPickersPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Pickers | Minimal UI</title> <title> MUI Components: Pickers | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -73,7 +73,7 @@ export default function MUIPopoverPage() { ...@@ -73,7 +73,7 @@ export default function MUIPopoverPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Popover | Minimal UI</title> <title> MUI Components: Popover | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -70,7 +70,7 @@ export default function MUIProgressPage() { ...@@ -70,7 +70,7 @@ export default function MUIProgressPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Progress | Minimal UI</title> <title> MUI Components: Progress | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -43,7 +43,7 @@ export default function MUIRadioButtonsPage() { ...@@ -43,7 +43,7 @@ export default function MUIRadioButtonsPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Radio Buttons | Minimal UI</title> <title> MUI Components: Radio Buttons | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -88,7 +88,7 @@ export default function MUIRatingPage() { ...@@ -88,7 +88,7 @@ export default function MUIRatingPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Rating | Minimal UI</title> <title> MUI Components: Rating | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -79,7 +79,7 @@ export default function MUISliderPage() { ...@@ -79,7 +79,7 @@ export default function MUISliderPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Slider | Minimal UI</title> <title> MUI Components: Slider | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -25,7 +25,7 @@ export default function MUIStepperPage() { ...@@ -25,7 +25,7 @@ export default function MUIStepperPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Stepper | Minimal UI</title> <title> MUI Components: Stepper | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -36,7 +36,7 @@ export default function MUISwitchPage() { ...@@ -36,7 +36,7 @@ export default function MUISwitchPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Switch | Minimal UI</title> <title> MUI Components: Switch | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -24,7 +24,7 @@ export default function MUITablePage() { ...@@ -24,7 +24,7 @@ export default function MUITablePage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Table | Minimal UI</title> <title> MUI Components: Table | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -78,7 +78,7 @@ export default function MUITabsPage() { ...@@ -78,7 +78,7 @@ export default function MUITabsPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Tabs | Minimal UI</title> <title> MUI Components: Tabs | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -32,7 +32,7 @@ export default function MUITextFieldPage() { ...@@ -32,7 +32,7 @@ export default function MUITextFieldPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Textfield | Minimal UI</title> <title> MUI Components: Textfield | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -106,7 +106,7 @@ export default function MUITimelinePage() { ...@@ -106,7 +106,7 @@ export default function MUITimelinePage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Timeline | Minimal UI</title> <title> MUI Components: Timeline | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -40,7 +40,7 @@ export default function MUITooltipPage() { ...@@ -40,7 +40,7 @@ export default function MUITooltipPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Tooltip | Minimal UI</title> <title> MUI Components: Tooltip | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -32,7 +32,7 @@ export default function MUITransferListPage() { ...@@ -32,7 +32,7 @@ export default function MUITransferListPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Transfer List | Minimal UI</title> <title> MUI Components: Transfer List | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -45,7 +45,7 @@ export default function MUITreesViewPage() { ...@@ -45,7 +45,7 @@ export default function MUITreesViewPage() {
return ( return (
<> <>
<Head> <Head>
<title> MUI Components: Tree View | Minimal UI</title> <title> MUI Components: Tree View | SignConnect+</title>
</Head> </Head>
<Box <Box
......
...@@ -19,7 +19,7 @@ export default function ContactPage() { ...@@ -19,7 +19,7 @@ export default function ContactPage() {
return ( return (
<> <>
<Head> <Head>
<title> Contact us | Minimal UI</title> <title> Contact us | SignConnect+</title>
</Head> </Head>
<ContactHero /> <ContactHero />
......
...@@ -38,7 +38,7 @@ export default function GeneralAnalyticsPage() { ...@@ -38,7 +38,7 @@ export default function GeneralAnalyticsPage() {
return ( return (
<> <>
<Head> <Head>
<title> General: Analytics | Minimal UI</title> <title> General: Analytics | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'xl'}> <Container maxWidth={themeStretch ? false : 'xl'}>
......
...@@ -49,7 +49,7 @@ export default function GeneralAppPage() { ...@@ -49,7 +49,7 @@ export default function GeneralAppPage() {
return ( return (
<> <>
<Head> <Head>
<title> General: App | Minimal UI</title> <title> General: App | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'xl'}> <Container maxWidth={themeStretch ? false : 'xl'}>
......
...@@ -40,7 +40,7 @@ export default function GeneralBankingPage() { ...@@ -40,7 +40,7 @@ export default function GeneralBankingPage() {
return ( return (
<> <>
<Head> <Head>
<title> General: Banking | Minimal UI</title> <title> General: Banking | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'xl'}> <Container maxWidth={themeStretch ? false : 'xl'}>
......
...@@ -18,7 +18,7 @@ export default function BlankPage() { ...@@ -18,7 +18,7 @@ export default function BlankPage() {
return ( return (
<> <>
<Head> <Head>
<title> Blank Page | Minimal UI</title> <title> Blank Page | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'xl'}> <Container maxWidth={themeStretch ? false : 'xl'}>
......
...@@ -24,7 +24,7 @@ export default function BlogNewPostPage() { ...@@ -24,7 +24,7 @@ export default function BlogNewPostPage() {
return ( return (
<> <>
<Head> <Head>
<title> Blog: New Post | Minimal UI</title> <title> Blog: New Post | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -87,7 +87,7 @@ export default function BlogPostPage() { ...@@ -87,7 +87,7 @@ export default function BlogPostPage() {
return ( return (
<> <>
<Head> <Head>
<title>{`Blog: ${post?.title || ''} | Minimal UI`}</title> <title>{`Blog: ${post?.title || ''} | SignConnect+`}</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -64,7 +64,7 @@ export default function BlogPostsPage() { ...@@ -64,7 +64,7 @@ export default function BlogPostsPage() {
return ( return (
<> <>
<Head> <Head>
<title> Blog: Posts | Minimal UI</title> <title> Blog: Posts | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -43,7 +43,7 @@ export default function GeneralBookingPage() { ...@@ -43,7 +43,7 @@ export default function GeneralBookingPage() {
return ( return (
<> <>
<Head> <Head>
<title> General: Booking | Minimal UI</title> <title> General: Booking | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'xl'}> <Container maxWidth={themeStretch ? false : 'xl'}>
......
...@@ -253,7 +253,7 @@ export default function CalendarPage() { ...@@ -253,7 +253,7 @@ export default function CalendarPage() {
return ( return (
<> <>
<Head> <Head>
<title> Calendar | Minimal UI</title> <title> Calendar | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'xl'}> <Container maxWidth={themeStretch ? false : 'xl'}>
......
...@@ -15,7 +15,7 @@ export default function ChatPage() { ...@@ -15,7 +15,7 @@ export default function ChatPage() {
return ( return (
<> <>
<Head> <Head>
<title> Chat | Minimal UI</title> <title> Chat | SignConnect+</title>
</Head> </Head>
<Chat /> <Chat />
......
...@@ -15,7 +15,7 @@ export default function ChatPage() { ...@@ -15,7 +15,7 @@ export default function ChatPage() {
return ( return (
<> <>
<Head> <Head>
<title> Chat | Minimal UI</title> <title> Chat | SignConnect+</title>
</Head> </Head>
<Chat /> <Chat />
......
...@@ -15,7 +15,7 @@ export default function ChatPage() { ...@@ -15,7 +15,7 @@ export default function ChatPage() {
return ( return (
<> <>
<Head> <Head>
<title> Chat | Minimal UI</title> <title> Chat | SignConnect+</title>
</Head> </Head>
<Chat /> <Chat />
......
...@@ -121,7 +121,7 @@ export default function EcommerceCheckoutPage() { ...@@ -121,7 +121,7 @@ export default function EcommerceCheckoutPage() {
return ( return (
<> <>
<Head> <Head>
<title> Ecommerce: Checkout | Minimal UI</title> <title> Ecommerce: Checkout | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -198,7 +198,7 @@ export default function EcommerceProductListPage() { ...@@ -198,7 +198,7 @@ export default function EcommerceProductListPage() {
return ( return (
<> <>
<Head> <Head>
<title> Ecommerce: Product List | Minimal UI</title> <title> Ecommerce: Product List | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -99,7 +99,7 @@ export default function EcommerceProductDetailsPage() { ...@@ -99,7 +99,7 @@ export default function EcommerceProductDetailsPage() {
return ( return (
<> <>
<Head> <Head>
<title>{`Ecommerce: ${product?.name || ''} | Minimal UI`}</title> <title>{`Ecommerce: ${product?.name || ''} | SignConnect+`}</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -46,7 +46,7 @@ export default function EcommerceProductEditPage() { ...@@ -46,7 +46,7 @@ export default function EcommerceProductEditPage() {
return ( return (
<> <>
<Head> <Head>
<title> Ecommerce: Edit product | Minimal UI</title> <title> Ecommerce: Edit product | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -26,7 +26,7 @@ export default function EcommerceProductCreatePage() { ...@@ -26,7 +26,7 @@ export default function EcommerceProductCreatePage() {
return ( return (
<> <>
<Head> <Head>
<title> Ecommerce: Create a new product | Minimal UI</title> <title> Ecommerce: Create a new product | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -96,7 +96,7 @@ export default function EcommerceShopPage() { ...@@ -96,7 +96,7 @@ export default function EcommerceShopPage() {
return ( return (
<> <>
<Head> <Head>
<title> Ecommerce: Shop | Minimal UI</title> <title> Ecommerce: Shop | SignConnect+</title>
</Head> </Head>
<FormProvider methods={methods}> <FormProvider methods={methods}>
......
...@@ -49,7 +49,7 @@ export default function GeneralEcommercePage() { ...@@ -49,7 +49,7 @@ export default function GeneralEcommercePage() {
return ( return (
<> <>
<Head> <Head>
<title> General: E-commerce | Minimal UI</title> <title> General: E-commerce | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'xl'}> <Container maxWidth={themeStretch ? false : 'xl'}>
......
...@@ -135,7 +135,7 @@ export default function GeneralFilePage() { ...@@ -135,7 +135,7 @@ export default function GeneralFilePage() {
return ( return (
<> <>
<Head> <Head>
<title> General: File | Minimal UI</title> <title> General: File | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'xl'}> <Container maxWidth={themeStretch ? false : 'xl'}>
......
...@@ -196,7 +196,7 @@ export default function FileManagerPage() { ...@@ -196,7 +196,7 @@ export default function FileManagerPage() {
return ( return (
<> <>
<Head> <Head>
<title> File Manager | Minimal UI</title> <title> File Manager | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -33,7 +33,7 @@ export default function InvoiceEditPage() { ...@@ -33,7 +33,7 @@ export default function InvoiceEditPage() {
return ( return (
<> <>
<Head> <Head>
<title> Invoice: Edit | Minimal UI</title> <title> Invoice: Edit | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -35,7 +35,7 @@ export default function InvoiceDetailsPage() { ...@@ -35,7 +35,7 @@ export default function InvoiceDetailsPage() {
return ( return (
<> <>
<Head> <Head>
<title> Invoice: View | Minimal UI</title> <title> Invoice: View | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -236,7 +236,7 @@ export default function InvoiceListPage() { ...@@ -236,7 +236,7 @@ export default function InvoiceListPage() {
return ( return (
<> <>
<Head> <Head>
<title> Invoice: List | Minimal UI</title> <title> Invoice: List | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -26,7 +26,7 @@ export default function InvoiceCreatePage() { ...@@ -26,7 +26,7 @@ export default function InvoiceCreatePage() {
return ( return (
<> <>
<Head> <Head>
<title> Invoices: Create a new invoice | Minimal UI</title> <title> Invoices: Create a new invoice | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -107,7 +107,7 @@ export default function KanbanPage() { ...@@ -107,7 +107,7 @@ export default function KanbanPage() {
return ( return (
<> <>
<Head> <Head>
<title> Kanban | Minimal UI</title> <title> Kanban | SignConnect+</title>
</Head> </Head>
<Container maxWidth={false} sx={{ height: 1 }}> <Container maxWidth={false} sx={{ height: 1 }}>
......
import { Container, Grid } from '@mui/material';
import Head from 'next/head';
import _mock from 'src/_mock/_mock';
import CustomBreadcrumbs from 'src/components/custom-breadcrumbs/CustomBreadcrumbs';
import Iconify from 'src/components/iconify/Iconify';
import CarouselAnimation from 'src/sections/@dashboard/learning-module/curriculum/CarouselAnimation';
import CarouselCenterMode from 'src/sections/@dashboard/learning-module/curriculum/CarouselCenterMode';
import { useSettingsContext } from '../../../../components/settings';
import DashboardLayout from '../../../../layouts/dashboard';
CurriculumHomePage.getLayout = (page: React.ReactElement) => <DashboardLayout>{page}</DashboardLayout>;
export default function CurriculumHomePage() {
const { themeStretch } = useSettingsContext();
const _carouselsExample = [...Array(5)].map((_, index) => ({
id: _mock.id(index),
title: _mock.text.title(index),
image: _mock.image.cover(index),
description: _mock.text.description(index),
}));
return (
<>
<Head>
<title> Curriculum Home | SignLink </title>
</Head>
<Container maxWidth={themeStretch ? false : 'xl'}>
<CustomBreadcrumbs
heading="Curriculum"
links={[
{
name: 'Dashboard',
href: '#',
icon: <Iconify icon="eva:home-fill" />,
},
{ name: 'Learning Module', href: '#', icon: <Iconify icon="eva:cube-outline" /> },
{ name: 'Curriculum', icon: <Iconify icon="eva:cube-outline" /> },
]}
/>
</Container>
<Container maxWidth={themeStretch ? false : 'xl'}>
<Grid container spacing={2} rowSpacing={2}>
<Grid md={12} item>
<CarouselAnimation data={_carouselsExample} />
</Grid>
<Grid md={12} item>
<CarouselCenterMode data={_carouselsExample} />
</Grid>
</Grid>
</Container>
</>
);
}
import { Card, CardContent, CardHeader, Container, Grid, Typography } from '@mui/material';
import Head from 'next/head';
import { useState } from 'react';
import CustomBreadcrumbs from 'src/components/custom-breadcrumbs/CustomBreadcrumbs';
import Editor from 'src/components/editor/Editor';
import Iconify from 'src/components/iconify/Iconify';
import { MegaMenuDesktopVertical, MegaMenuItemProps } from 'src/components/mega-menu';
import Scrollbar from 'src/components/scrollbar/Scrollbar';
import { NAV } from 'src/config';
import { useSettingsContext } from '../../../../components/settings';
import DashboardLayout from '../../../../layouts/dashboard';
CurriculumProcessPage.getLayout = (page: React.ReactElement) => <DashboardLayout>{page}</DashboardLayout>;
export default function CurriculumProcessPage() {
const { themeStretch } = useSettingsContext();
const [quillSimple, setQuillSimple] = useState('');
const ICON_SIZE = {
width: '100%',
height: '100%',
};
const data: MegaMenuItemProps[] = [
{
title: 'Parent 1',
path: '#',
icon: <Iconify icon="eva:file-fill" {...ICON_SIZE} />,
},
{
title: 'Parent 2',
path: '#',
icon: <Iconify icon="eva:file-fill" {...ICON_SIZE} />,
},
{
title: 'Parent 3',
path: '#',
icon: <Iconify icon="eva:file-fill" {...ICON_SIZE} />,
},
{
title: 'Parent 4',
path: '#',
icon: <Iconify icon="eva:file-fill" {...ICON_SIZE} />,
},
{
title: 'Parent 5',
path: '#',
icon: <Iconify icon="eva:file-fill" {...ICON_SIZE} />,
},
{
title: 'Parent 6',
path: '#',
icon: <Iconify icon="eva:file-fill" {...ICON_SIZE} />,
},
{
title: 'Parent 7',
path: '#',
icon: <Iconify icon="eva:file-fill" {...ICON_SIZE} />,
},
{
title: 'Parent 8',
path: '#',
icon: <Iconify icon="eva:file-fill" {...ICON_SIZE} />,
},
{
title: 'Parent 9',
path: '#',
icon: <Iconify icon="eva:file-fill" {...ICON_SIZE} />,
},
{
title: 'Parent 10',
path: '#',
icon: <Iconify icon="eva:file-fill" {...ICON_SIZE} />,
},
];
return (
<>
<Head>
<title> Curriculum Process | SignLink </title>
</Head>
<Container maxWidth={themeStretch ? false : 'xl'}>
<CustomBreadcrumbs
heading="Curriculum Process"
links={[
{
name: 'Dashboard',
href: '#',
icon: <Iconify icon="eva:home-fill" />,
},
{ name: 'Learning Module', href: '#', icon: <Iconify icon="eva:cube-outline" /> },
{ name: 'Curriculum', href: '#', icon: <Iconify icon="eva:cube-outline" /> },
{ name: 'Curriculum Process', icon: <Iconify icon="eva:cube-outline" /> },
]}
/>
</Container>
<Container maxWidth={themeStretch ? false : 'xl'}>
<Grid container spacing={2} rowSpacing={2}>
<Grid md={3} item>
<Card sx={{ width: NAV.W_BASE, flexShrink: 0, overflow: 'unset', zIndex: 9 }}>
<Typography variant="h6" sx={{ p: 2, display: 'flex', alignItems: 'center' }}>
<Iconify icon="eva:list-fill" width={24} sx={{ mr: 1 }} /> Curriculum Items
</Typography>
<MegaMenuDesktopVertical data={data} />
</Card>
</Grid>
<Grid md={9} item>
<Grid container spacing={2} rowSpacing={2}>
<Grid md={12} item>
<Card>
<CardHeader title="Curriculum Item 01" />
<CardContent sx={{ height: 200 }}>
<Scrollbar>
Donec mi odio, faucibus at, scelerisque quis, convallis in, nisi. Quisque ut nisi.
Suspendisse nisl elit, rhoncus eget, elementum ac, condimentum eget, diam.
Vestibulum eu odio. Proin sapien ipsum, porta a, auctor quis, euismod ut, mi. Cras
ultricies mi eu turpis hendrerit fringilla. Phasellus consectetuer vestibulum
elit. Phasellus magna. Nullam tincidunt adipiscing enim. Vestibulum volutpat
pretium libero. Nullam quis ante.
</Scrollbar>
</CardContent>
</Card>
</Grid>
<Grid md={12} item>
<Card>
<CardHeader title="Curriculum item 01 work space" />
<CardContent>
<Editor
simple
id="simple-editor"
value={quillSimple}
onChange={(value) => setQuillSimple(value)}
/>
</CardContent>
</Card>
</Grid>
</Grid>
</Grid>
</Grid>
</Container>
</>
);
}
import { Container, Typography } from '@mui/material';
import Head from 'next/head';
import { useSettingsContext } from '../../../../components/settings';
import DashboardLayout from '../../../../layouts/dashboard';
import CustomBreadcrumbs from 'src/components/custom-breadcrumbs/CustomBreadcrumbs';
import Iconify from 'src/components/iconify/Iconify';
FeedbackHomePage.getLayout = (page: React.ReactElement) => <DashboardLayout>{page}</DashboardLayout>;
export default function FeedbackHomePage() {
const { themeStretch } = useSettingsContext();
return (
<>
<Head>
<title> Feedback Home | SignLink </title>
</Head>
<Container maxWidth={themeStretch ? false : 'xl'}>
<CustomBreadcrumbs
heading="Feedback"
links={[
{
name: 'Dashboard',
href: '#',
icon: <Iconify icon="eva:home-fill" />,
},
{ name: 'Learning Module', href: '#', icon: <Iconify icon="eva:cube-outline" /> },
{ name: 'Feedback', icon: <Iconify icon="eva:cube-outline" /> },
]}
/>
</Container>
<Container maxWidth={themeStretch ? false : 'xl'}>
</Container>
</>
);
}
import { Box, Container, Stack, Typography } from '@mui/material';
import Head from 'next/head';
import { ComingSoonIllustration } from 'src/assets/illustrations';
import useCountdown from 'src/hooks/useCountdown';
import { useSettingsContext } from '../../../../components/settings';
import DashboardLayout from '../../../../layouts/dashboard';
LeadBoardHomePage.getLayout = (page: React.ReactElement) => <DashboardLayout>{page}</DashboardLayout>;
export default function LeadBoardHomePage() {
const { themeStretch } = useSettingsContext();
const { days, hours, minutes, seconds } = useCountdown(new Date('06/20/2023 21:30'));
return (
<>
{/* <Head>
<title> Lead Board Home | SignLink </title>
</Head>
<Container maxWidth={themeStretch ? false : 'xl'}>
<CustomBreadcrumbs
heading="Lead Board"
links={[
{
name: 'Dashboard',
href: '#',
icon: <Iconify icon="eva:home-fill" />,
},
{ name: 'Learning Module', href: '#', icon: <Iconify icon="eva:cube-outline" /> },
{ name: 'Lead Board', icon: <Iconify icon="eva:cube-outline" /> },
]}
/>
</Container>
<Container maxWidth={themeStretch ? false : 'xl'}>
</Container> */}
<Head>
<title> Coming Soon | SignConnect+</title>
</Head>
<Container maxWidth={themeStretch ? false : 'xl'}>
<Typography variant="h3" paragraph>
Coming Soon!
</Typography>
<Typography sx={{ color: 'text.secondary' }}>
We are currently working hard on this page!
</Typography>
<ComingSoonIllustration sx={{ my: 10, height: 240 }} />
<Stack
direction="row"
justifyContent="center"
divider={<Box sx={{ mx: { xs: 1, sm: 2.5 } }}>:</Box>}
sx={{ typography: 'h2' }}
>
<TimeBlock label="Days" value={days} />
<TimeBlock label="Hours" value={hours} />
<TimeBlock label="Minutes" value={minutes} />
<TimeBlock label="Seconds" value={seconds} />
</Stack>
</Container>
</>
);
}
type TimeBlockProps = {
label: string;
value: string;
};
function TimeBlock({ label, value }: TimeBlockProps) {
return (
<div>
<Box> {value} </Box>
<Box sx={{ color: 'text.secondary', typography: 'body1' }}>{label}</Box>
</div>
);
}
\ No newline at end of file
import { Box, Container, Stack, Typography } from '@mui/material';
import Head from 'next/head';
import { ComingSoonIllustration } from 'src/assets/illustrations';
import useCountdown from 'src/hooks/useCountdown';
import { useSettingsContext } from '../../../../components/settings';
import DashboardLayout from '../../../../layouts/dashboard';
QuestionAndAnswersHomePage.getLayout = (page: React.ReactElement) => <DashboardLayout>{page}</DashboardLayout>;
export default function QuestionAndAnswersHomePage() {
const { themeStretch } = useSettingsContext();
const { days, hours, minutes, seconds } = useCountdown(new Date('06/20/2023 21:30'));
return (
<>
{/* <Head>
<title> Questions & Answers Home | SignLink </title>
</Head>
<Container maxWidth={themeStretch ? false : 'xl'}>
<CustomBreadcrumbs
heading="Questions & Answers"
links={[
{
name: 'Dashboard',
href: '#',
icon: <Iconify icon="eva:home-fill" />,
},
{ name: 'Learning Module', href: '#', icon: <Iconify icon="eva:cube-outline" /> },
{ name: 'Questions & Answers', icon: <Iconify icon="eva:cube-outline" /> },
]}
/>
</Container>
<Container maxWidth={themeStretch ? false : 'xl'}>
</Container> */}
<Head>
<title> Coming Soon | SignConnect+</title>
</Head>
<Container maxWidth={themeStretch ? false : 'xl'}>
<Typography variant="h3" paragraph>
Coming Soon!
</Typography>
<Typography sx={{ color: 'text.secondary' }}>
We are currently working hard on this page!
</Typography>
<ComingSoonIllustration sx={{ my: 10, height: 240 }} />
<Stack
direction="row"
justifyContent="center"
divider={<Box sx={{ mx: { xs: 1, sm: 2.5 } }}>:</Box>}
sx={{ typography: 'h2' }}
>
<TimeBlock label="Days" value={days} />
<TimeBlock label="Hours" value={hours} />
<TimeBlock label="Minutes" value={minutes} />
<TimeBlock label="Seconds" value={seconds} />
</Stack>
</Container>
</>
);
}
type TimeBlockProps = {
label: string;
value: string;
};
function TimeBlock({ label, value }: TimeBlockProps) {
return (
<div>
<Box> {value} </Box>
<Box sx={{ color: 'text.secondary', typography: 'body1' }}>{label}</Box>
</div>
);
}
\ No newline at end of file
...@@ -15,7 +15,7 @@ export default function MailPage() { ...@@ -15,7 +15,7 @@ export default function MailPage() {
return ( return (
<> <>
<Head> <Head>
<title> Mail | Minimal UI</title> <title> Mail | SignConnect+</title>
</Head> </Head>
<Mail /> <Mail />
......
...@@ -15,7 +15,7 @@ export default function MailPage() { ...@@ -15,7 +15,7 @@ export default function MailPage() {
return ( return (
<> <>
<Head> <Head>
<title> Mail | Minimal UI</title> <title> Mail | SignConnect+</title>
</Head> </Head>
<Mail /> <Mail />
......
...@@ -15,7 +15,7 @@ export default function MailPage() { ...@@ -15,7 +15,7 @@ export default function MailPage() {
return ( return (
<> <>
<Head> <Head>
<title> Mail | Minimal UI</title> <title> Mail | SignConnect+</title>
</Head> </Head>
<Mail /> <Mail />
......
...@@ -15,7 +15,7 @@ export default function MailPage() { ...@@ -15,7 +15,7 @@ export default function MailPage() {
return ( return (
<> <>
<Head> <Head>
<title> Mail | Minimal UI</title> <title> Mail | SignConnect+</title>
</Head> </Head>
<Mail /> <Mail />
......
...@@ -43,7 +43,7 @@ export default function PermissionDeniedPage() { ...@@ -43,7 +43,7 @@ export default function PermissionDeniedPage() {
return ( return (
<> <>
<Head> <Head>
<title> Other Cases: Permission Denied | Minimal UI</title> <title> Other Cases: Permission Denied | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
import { Container, Typography } from '@mui/material';
import Head from 'next/head';
import { useSettingsContext } from '../../../components/settings';
import DashboardLayout from '../../../layouts/dashboard';
SpokenLanguageTranslationHomePage.getLayout = (page: React.ReactElement) => <DashboardLayout>{page}</DashboardLayout>;
export default function SpokenLanguageTranslationHomePage() {
const { themeStretch } = useSettingsContext();
return (
<>
<Head>
<title> Blank Page | SignConnect+</title>
</Head>
<Container maxWidth={themeStretch ? false : 'xl'}>
<Typography variant="h6"> Blank </Typography>
</Container>
</>
);
}
...@@ -34,7 +34,7 @@ export default function UserEditPage() { ...@@ -34,7 +34,7 @@ export default function UserEditPage() {
return ( return (
<> <>
<Head> <Head>
<title> User: Edit user | Minimal UI</title> <title> User: Edit user | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -75,7 +75,7 @@ export default function UserAccountPage() { ...@@ -75,7 +75,7 @@ export default function UserAccountPage() {
return ( return (
<> <>
<Head> <Head>
<title> User: Account Settings | Minimal UI</title> <title> User: Account Settings | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -26,7 +26,7 @@ export default function UserCardsPage() { ...@@ -26,7 +26,7 @@ export default function UserCardsPage() {
return ( return (
<> <>
<Head> <Head>
<title> User: Cards | Minimal UI</title> <title> User: Cards | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -195,7 +195,7 @@ export default function UserListPage() { ...@@ -195,7 +195,7 @@ export default function UserListPage() {
return ( return (
<> <>
<Head> <Head>
<title> User: List | Minimal UI</title> <title> User: List | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -24,7 +24,7 @@ export default function UserCreatePage() { ...@@ -24,7 +24,7 @@ export default function UserCreatePage() {
return ( return (
<> <>
<Head> <Head>
<title> User: Create a new user | Minimal UI</title> <title> User: Create a new user | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -83,7 +83,7 @@ export default function UserProfilePage() { ...@@ -83,7 +83,7 @@ export default function UserProfilePage() {
return ( return (
<> <>
<Head> <Head>
<title> User: Profile | Minimal UI</title> <title> User: Profile | SignConnect+</title>
</Head> </Head>
<Container maxWidth={themeStretch ? false : 'lg'}> <Container maxWidth={themeStretch ? false : 'lg'}>
......
...@@ -17,7 +17,7 @@ export default function FaqsPage() { ...@@ -17,7 +17,7 @@ export default function FaqsPage() {
return ( return (
<> <>
<Head> <Head>
<title> Faqs | Minimal UI</title> <title> Faqs | SignConnect+</title>
</Head> </Head>
<FaqsHero /> <FaqsHero />
......
import { m, useScroll, useSpring } from 'framer-motion';
// next
import Head from 'next/head';
// @mui
import { useTheme } from '@mui/material/styles';
import { Box } from '@mui/material';
// layouts
import MainLayout from '../layouts/main';
// sections
import {
HomeHero,
HomeMinimal,
HomeDarkMode,
HomeLookingFor,
HomeForDesigner,
HomeColorPresets,
HomePricingPlans,
HomeAdvertisement,
HomeCleanInterfaces,
HomeHugePackElements,
} from '../sections/home';
// ----------------------------------------------------------------------
HomePage.getLayout = (page: React.ReactElement) => <MainLayout> {page} </MainLayout>;
// ----------------------------------------------------------------------
export default function HomePage() {
const theme = useTheme();
const { scrollYProgress } = useScroll();
const scaleX = useSpring(scrollYProgress, {
stiffness: 100,
damping: 30,
restDelta: 0.001,
});
const progress = (
<m.div
style={{
top: 0,
left: 0,
right: 0,
height: 3,
zIndex: 1999,
position: 'fixed',
transformOrigin: '0%',
backgroundColor: theme.palette.primary.main,
scaleX,
}}
/>
);
return (
<>
<Head>
<title> The starting point for your next project | SignConnect+</title>
</Head>
{progress}
<HomeHero />
<Box
sx={{
overflow: 'hidden',
position: 'relative',
bgcolor: 'background.default',
}}
>
<HomeMinimal />
<HomeHugePackElements />
<HomeForDesigner />
<HomeDarkMode />
<HomeColorPresets />
<HomeCleanInterfaces />
<HomePricingPlans />
<HomeLookingFor />
<HomeAdvertisement />
</Box>
</>
);
}
import { m, useScroll, useSpring } from 'framer-motion'; import LoginPage from "./auth/login";
// next
import Head from 'next/head';
// @mui
import { useTheme } from '@mui/material/styles';
import { Box } from '@mui/material';
// layouts
import MainLayout from '../layouts/main';
// sections
import {
HomeHero,
HomeMinimal,
HomeDarkMode,
HomeLookingFor,
HomeForDesigner,
HomeColorPresets,
HomePricingPlans,
HomeAdvertisement,
HomeCleanInterfaces,
HomeHugePackElements,
} from '../sections/home';
// ---------------------------------------------------------------------- export default LoginPage
\ No newline at end of file
HomePage.getLayout = (page: React.ReactElement) => <MainLayout> {page} </MainLayout>;
// ----------------------------------------------------------------------
export default function HomePage() {
const theme = useTheme();
const { scrollYProgress } = useScroll();
const scaleX = useSpring(scrollYProgress, {
stiffness: 100,
damping: 30,
restDelta: 0.001,
});
const progress = (
<m.div
style={{
top: 0,
left: 0,
right: 0,
height: 3,
zIndex: 1999,
position: 'fixed',
transformOrigin: '0%',
backgroundColor: theme.palette.primary.main,
scaleX,
}}
/>
);
return (
<>
<Head>
<title> The starting point for your next project | Minimal UI</title>
</Head>
{progress}
<HomeHero />
<Box
sx={{
overflow: 'hidden',
position: 'relative',
bgcolor: 'background.default',
}}
>
<HomeMinimal />
<HomeHugePackElements />
<HomeForDesigner />
<HomeDarkMode />
<HomeColorPresets />
<HomeCleanInterfaces />
<HomePricingPlans />
<HomeLookingFor />
<HomeAdvertisement />
</Box>
</>
);
}
...@@ -18,7 +18,7 @@ export default function MaintenancePage() { ...@@ -18,7 +18,7 @@ export default function MaintenancePage() {
return ( return (
<> <>
<Head> <Head>
<title> Maintenance | Minimal UI</title> <title> Maintenance | SignConnect+</title>
</Head> </Head>
<Stack sx={{ alignItems: 'center' }}> <Stack sx={{ alignItems: 'center' }}>
......
...@@ -21,7 +21,7 @@ export default function PaymentPage() { ...@@ -21,7 +21,7 @@ export default function PaymentPage() {
return ( return (
<> <>
<Head> <Head>
<title> Payment | Minimal UI</title> <title> Payment | SignConnect+</title>
</Head> </Head>
<Container <Container
......
...@@ -19,7 +19,7 @@ export default function PricingPage() { ...@@ -19,7 +19,7 @@ export default function PricingPage() {
return ( return (
<> <>
<Head> <Head>
<title> Pricing | Minimal UI</title> <title> Pricing | SignConnect+</title>
</Head> </Head>
<Container <Container
......
...@@ -97,6 +97,18 @@ export const PATH_DASHBOARD = { ...@@ -97,6 +97,18 @@ export const PATH_DASHBOARD = {
view: (title: string) => path(ROOTS_DASHBOARD, `/blog/post/${title}`), view: (title: string) => path(ROOTS_DASHBOARD, `/blog/post/${title}`),
demoView: path(ROOTS_DASHBOARD, '/blog/post/apply-these-7-secret-techniques-to-improve-event'), demoView: path(ROOTS_DASHBOARD, '/blog/post/apply-these-7-secret-techniques-to-improve-event'),
}, },
spokenLanguageTranslationModule: {
root: path(ROOTS_DASHBOARD, '/spokenLanguageTranslation-module'),
spokenLanguageTranslationHome: path(ROOTS_DASHBOARD, '/spokenLanguageTranslation-module'),
},
learningModule: {
root: path(ROOTS_DASHBOARD, '/learning-module'),
curriculumHome: path(ROOTS_DASHBOARD, '/learning-module/curriculum'),
curriculumView: path(ROOTS_DASHBOARD, '/learning-module/curriculum/process'),
questionAndAnswersHome: path(ROOTS_DASHBOARD, '/learning-module/questionAndAnswers'),
leadBoardHome: path(ROOTS_DASHBOARD, '/learning-module/leadBoard'),
feedbackHome: path(ROOTS_DASHBOARD, '/learning-module/feedback'),
},
}; };
export const PATH_DOCS = { export const PATH_DOCS = {
......
import { m } from 'framer-motion';
import { useRef, useState } from 'react';
// @mui
import { Box, Button, Card, CardContent, Paper, Typography } from '@mui/material';
import { alpha, useTheme } from '@mui/material/styles';
// utils
import { bgGradient } from '../../../../utils/cssStyles';
// components
import Link from 'next/link';
import { PATH_DASHBOARD } from 'src/routes/paths';
import { MotionContainer, varFade } from '../../../../components/animate';
import Carousel, { CarouselArrowIndex } from '../../../../components/carousel';
import Image from '../../../../components/image';
// ----------------------------------------------------------------------
type Props = {
data: {
id: string;
title: string;
image: string;
description: string;
}[];
};
export default function CarouselAnimation({ data }: Props) {
const theme = useTheme();
const carouselRef = useRef<Carousel | null>(null);
const [currentIndex, setCurrentIndex] = useState(theme.direction === 'rtl' ? data.length - 1 : 0);
const carouselSettings = {
speed: 800,
dots: false,
arrows: false,
autoplay: true,
slidesToShow: 1,
slidesToScroll: 1,
rtl: Boolean(theme.direction === 'rtl'),
beforeChange: (current: number, next: number) => setCurrentIndex(next),
};
const handlePrev = () => {
carouselRef.current?.slickPrev();
};
const handleNext = () => {
carouselRef.current?.slickNext();
};
return (
<Card>
<Carousel ref={carouselRef} {...carouselSettings}>
{data.map((item, index) => (
<CarouselItem key={item.id} item={item} isActive={index === currentIndex} />
))}
</Carousel>
<CarouselArrowIndex
index={currentIndex}
total={data.length}
onNext={handleNext}
onPrevious={handlePrev}
/>
</Card>
);
}
// ----------------------------------------------------------------------
type CarouselItemProps = {
item: {
title: string;
description: string;
image: string;
};
isActive: boolean;
};
function CarouselItem({ item, isActive }: CarouselItemProps) {
const theme = useTheme();
const { image, title } = item;
return (
<Paper sx={{ position: 'relative', height: 300 }}>
<Image alt={title} src={image} ratio="21/9" />
<Box
sx={{
top: 0,
width: 1,
height: 1,
position: 'absolute',
...bgGradient({
direction: 'to top',
startColor: `${theme.palette.grey[900]} 0%`,
endColor: `${alpha(theme.palette.grey[900], 0)} 100%`,
}),
}}
/>
<CardContent
component={MotionContainer}
animate={isActive}
action
sx={{
bottom: 0,
width: 1,
maxWidth: 720,
textAlign: 'left',
position: 'absolute',
color: 'common.white',
}}
>
<m.div variants={varFade().inRight}>
<Typography variant="h3" gutterBottom>
{item.title}
</Typography>
</m.div>
<m.div variants={varFade().inRight}>
<Typography variant="body2" noWrap gutterBottom>
{item.description}
</Typography>
</m.div>
<m.div variants={varFade().inRight}>
<Link href={PATH_DASHBOARD.learningModule.curriculumView}>
<Button variant="contained" sx={{ mt: 3 }}>
View More
</Button>
</Link>
</m.div>
</CardContent>
</Paper>
);
}
import { useRef } from 'react';
// @mui
import { alpha, useTheme } from '@mui/material/styles';
import { Box, Paper, Link, CardContent } from '@mui/material';
// utils
import { bgGradient } from '../../../../utils/cssStyles';
// components
import Image from '../../../../components/image';
import Iconify from '../../../../components/iconify';
import TextMaxLine from '../../../../components/text-max-line';
import Carousel, { CarouselArrows } from '../../../../components/carousel';
import { PATH_DASHBOARD } from 'src/routes/paths';
// ----------------------------------------------------------------------
type Props = {
data: {
id: string;
title: string;
image: string;
description: string;
}[];
};
export default function CarouselCenterMode({ data }: Props) {
const carouselRef = useRef<Carousel | null>(null);
const theme = useTheme();
const carouselSettings = {
slidesToShow: 3,
centerMode: true,
centerPadding: '60px',
rtl: Boolean(theme.direction === 'rtl'),
responsive: [
{
breakpoint: 1024,
settings: { slidesToShow: 2 },
},
{
breakpoint: 600,
settings: { slidesToShow: 2 },
},
{
breakpoint: 480,
settings: { slidesToShow: 1, centerPadding: '0' },
},
],
};
const handlePrev = () => {
carouselRef.current?.slickPrev();
};
const handleNext = () => {
carouselRef.current?.slickNext();
};
return (
<Box
sx={{
overflow: 'hidden',
position: 'relative',
}}
>
<CarouselArrows
filled
icon="noto:rightwards-hand"
onNext={handleNext}
onPrevious={handlePrev}
>
<Carousel ref={carouselRef} {...carouselSettings}>
{data.map((item) => (
<Box key={item.id} sx={{ px: 1 }}>
<CarouselItem item={item} />
</Box>
))}
</Carousel>
</CarouselArrows>
</Box>
);
}
// ----------------------------------------------------------------------
type CarouselItemProps = {
title: string;
description: string;
image: string;
};
function CarouselItem({ item }: { item: CarouselItemProps }) {
const theme = useTheme();
const { image, title } = item;
return (
<Paper
sx={{
borderRadius: 2,
overflow: 'hidden',
position: 'relative'
}}
>
<Image alt={title} src={image} ratio="3/4" />
<CardContent
sx={{
bottom: 0,
zIndex: 9,
width: '100%',
textAlign: 'left',
position: 'absolute',
color: 'common.white',
...bgGradient({
direction: 'to top',
startColor: `${theme.palette.grey[900]} 25%`,
endColor: `${alpha(theme.palette.grey[900], 0)} 100%`,
}),
}}
>
<TextMaxLine variant="h4" paragraph>
{title}
</TextMaxLine>
<Link
color="inherit"
variant="overline"
sx={{
opacity: 0.72,
alignItems: 'center',
display: 'inline-flex',
transition: (theme) => theme.transitions.create('opacity'),
'&:hover': { opacity: 1 },
}}
href={PATH_DASHBOARD.learningModule.curriculumView}
>
learn More
<Iconify icon="eva:arrow-forward-fill" width={16} sx={{ ml: 1 }} />
</Link>
</CardContent>
</Paper>
);
}
import { Box, CardProps, Stack, Typography } from '@mui/material';
import { useTheme } from '@mui/material/styles';
import Iconify from 'src/components/iconify/Iconify';
import { ColorSchema } from 'src/theme/palette';
interface Props extends CardProps {
icon: string;
title: string;
subTitle: string
color?: ColorSchema;
handleClick?: any
}
export default function HomeWidget({
title,
icon,
color = 'primary',
subTitle,
sx,
handleClick,
...other
}: Props) {
const theme = useTheme();
return (
<Stack
direction="row"
alignItems="center"
sx={{
p: 3,
borderRadius: 2,
overflow: 'hidden',
position: 'relative',
color: 'common.white',
bgcolor: `${color}.dark`,
...sx,
}}
{...other}
>
<Box sx={{ ml: 3 }}>
<Typography variant="h4"
onClick={() => {
console.log(title);
handleClick(title)
}}
sx={{ cursor: 'pointer' }}
> {title}</Typography>
<Typography variant="body2" sx={{ opacity: 0.72 }}>
{subTitle}
</Typography>
</Box>
<Iconify
icon={icon}
sx={{
width: 120,
height: 120,
opacity: 0.12,
position: 'absolute',
right: theme.spacing(-0),
}}
/>
</Stack>
);
}
...@@ -20,7 +20,7 @@ export default function Login() { ...@@ -20,7 +20,7 @@ export default function Login() {
return ( return (
<LoginLayout> <LoginLayout>
<Stack spacing={2} sx={{ mb: 5, position: 'relative' }}> <Stack spacing={2} sx={{ mb: 5, position: 'relative' }}>
<Typography variant="h4">Sign in to Minimal</Typography> <Typography variant="h4">Sign in to SignConnect+</Typography>
<Stack direction="row" spacing={0.5}> <Stack direction="row" spacing={0.5}>
<Typography variant="body2">New user?</Typography> <Typography variant="body2">New user?</Typography>
...@@ -45,8 +45,6 @@ export default function Login() { ...@@ -45,8 +45,6 @@ export default function Login() {
</Alert> </Alert>
<AuthLoginForm /> <AuthLoginForm />
<AuthWithSocial />
</LoginLayout> </LoginLayout>
); );
} }
// next // next
import NextLink from 'next/link'; import NextLink from 'next/link';
// @mui // @mui
import { Stack, Typography, Link } from '@mui/material'; import { Link, Stack, Typography } from '@mui/material';
// layouts // layouts
import LoginLayout from '../../layouts/login'; import LoginLayout from '../../layouts/login';
// routes // routes
import { PATH_AUTH } from '../../routes/paths'; import { PATH_AUTH } from '../../routes/paths';
// //
import AuthWithSocial from './AuthWithSocial';
import AuthRegisterForm from './AuthRegisterForm'; import AuthRegisterForm from './AuthRegisterForm';
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
...@@ -44,7 +43,6 @@ export default function Register() { ...@@ -44,7 +43,6 @@ export default function Register() {
. .
</Typography> </Typography>
<AuthWithSocial />
</LoginLayout> </LoginLayout>
); );
} }
...@@ -58,7 +58,7 @@ export default function HomeMinimal() { ...@@ -58,7 +58,7 @@ export default function HomeMinimal() {
> >
<m.div variants={varFade().inUp}> <m.div variants={varFade().inUp}>
<Typography component="div" variant="overline" sx={{ color: 'text.disabled' }}> <Typography component="div" variant="overline" sx={{ color: 'text.disabled' }}>
Minimal UI SignConnect+
</Typography> </Typography>
</m.div> </m.div>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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