diff --git a/mnist.ipynb b/mnist.ipynb
index 1315c1c..b929ff9 100644
--- a/mnist.ipynb
+++ b/mnist.ipynb
@@ -234,7 +234,7 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 34,
"metadata": {},
"outputs": [
{
@@ -255,7 +255,19 @@
" font-size: 16px;\n",
" border-radius: 3px;\n",
" margin-top: 10px;\n",
- " width: 400px;\n",
+ " width: 190px;\n",
+ " margin-right: 20px;\n",
+ " }\n",
+ " #clear-button {\n",
+ " background-color: #FF0000,; \n",
+ " color: black;\n",
+ " border: none;\n",
+ " padding: 10px 20px;\n",
+ " cursor: pointer;\n",
+ " font-size: 16px;\n",
+ " border-radius: 3px;\n",
+ " margin-top: 10px;\n",
+ " width: 190px;\n",
" }\n",
" #container {\n",
" display: flex;\n",
@@ -263,11 +275,20 @@
" align-items: center; /* Center horizontally */\n",
" justify-content: center;\n",
" }\n",
+ " #btn-container {\n",
+ " display: flex;\n",
+ " flex-direction: row; /* Arrange children vertically */\n",
+ " align-items: center; /* Center horizontally */\n",
+ " }\n",
"\n",
"\n",
"
\n",
"
\n",
+ "
\n",
"\n",
+ "\n",
+ "
\n",
+ "\n",
"
\n",
"\n"
],
@@ -321,7 +352,19 @@
" font-size: 16px;\n",
" border-radius: 3px;\n",
" margin-top: 10px;\n",
- " width: 400px;\n",
+ " width: 190px;\n",
+ " margin-right: 20px;\n",
+ " }\n",
+ " #clear-button {\n",
+ " background-color: #FF0000,; \n",
+ " color: black;\n",
+ " border: none;\n",
+ " padding: 10px 20px;\n",
+ " cursor: pointer;\n",
+ " font-size: 16px;\n",
+ " border-radius: 3px;\n",
+ " margin-top: 10px;\n",
+ " width: 190px;\n",
" }\n",
" #container {\n",
" display: flex;\n",
@@ -329,11 +372,20 @@
" align-items: center; /* Center horizontally */\n",
" justify-content: center;\n",
" }\n",
+ " #btn-container {\n",
+ " display: flex;\n",
+ " flex-direction: row; /* Arrange children vertically */\n",
+ " align-items: center; /* Center horizontally */\n",
+ " }\n",
"\n",
"\n",
"\n",
"
\n",
+ "
\n",
"\n",
+ "\n",
+ "
\n",
+ "\n",
"
\n",
"\n"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": 36,
+ "metadata": {},
+ "outputs": [
+ {
+ "ename": "NameError",
+ "evalue": "name 'image_data' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "\u001b[1;32m/arun477/vae/mnist.ipynb Cell 13\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mtorch\u001b[39;00m\n\u001b[1;32m 8\u001b[0m \u001b[39m# Extract the base64 portion of the data URL\u001b[39;00m\n\u001b[0;32m----> 9\u001b[0m image_data_base64 \u001b[39m=\u001b[39m re\u001b[39m.\u001b[39msub(\u001b[39m'\u001b[39m\u001b[39m^data:image/.+;base64,\u001b[39m\u001b[39m'\u001b[39m, \u001b[39m'\u001b[39m\u001b[39m'\u001b[39m, image_data)\n\u001b[1;32m 11\u001b[0m \u001b[39m# Decode the base64 string to bytes and create a PIL Image\u001b[39;00m\n\u001b[1;32m 12\u001b[0m image_bytes \u001b[39m=\u001b[39m base64\u001b[39m.\u001b[39mb64decode(image_data_base64)\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'image_data' is not defined"
+ ]
+ }
+ ],
+ "source": [
+ "import numpy as np\n",
+ "from PIL import Image\n",
+ "import io\n",
+ "import re\n",
+ "import base64\n",
+ "import torch\n",
+ "\n",
+ "# Extract the base64 portion of the data URL\n",
+ "image_data_base64 = re.sub('^data:image/.+;base64,', '', image_data)\n",
+ "\n",
+ "# Decode the base64 string to bytes and create a PIL Image\n",
+ "image_bytes = base64.b64decode(image_data_base64)\n",
+ "image = Image.open(io.BytesIO(image_bytes))\n",
+ "\n",
+ "# Convert the PIL Image to a NumPy array\n",
+ "image_np = np.array(image)\n",
+ "image_tensor = torch.from_numpy(image_np)\n",
+ "image_tensor.shape"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
|