diff --git "a/image_experimentation.ipynb" "b/image_experimentation.ipynb" new file mode 100644--- /dev/null +++ "b/image_experimentation.ipynb" @@ -0,0 +1,144 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "<>:3: SyntaxWarning: invalid escape sequence '\\d'\n", + "<>:3: SyntaxWarning: invalid escape sequence '\\d'\n", + "C:\\Users\\rajst\\AppData\\Local\\Temp\\ipykernel_7480\\2142218593.py:3: SyntaxWarning: invalid escape sequence '\\d'\n", + " with open(\"DataBase\\datetimeRecords.json\") as read:\n" + ] + } + ], + "source": [ + "import json\n", + "import numpy as np\n", + "with open(\"DataBase\\datetimeRecords.json\") as read:\n", + " temp=json.load(read)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [], + "source": [ + "for session in temp['mayank.raj']:\n", + " if \"2024-11-30 13:34:04.859226\" in session:\n", + " image=session['2024-11-30 13:34:04.859226']['create a photo of a snake']\n", + " value=np.array(image)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [], + "source": [ + "from PIL import Image" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(512, 512, 3)" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "np.shape(value)" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "ename": "TypeError", + "evalue": "Cannot handle this data type: (1, 1, 3), 3098\u001b[0m mode, rawmode \u001b[38;5;241m=\u001b[39m \u001b[43m_fromarray_typemap\u001b[49m\u001b[43m[\u001b[49m\u001b[43mtypekey\u001b[49m\u001b[43m]\u001b[49m\n\u001b[0;32m 3099\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n", + "\u001b[1;31mKeyError\u001b[0m: ((1, 1, 3), ' 1\u001b[0m data\u001b[38;5;241m=\u001b[39m\u001b[43mImage\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfromarray\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[1;32md:\\external\\Experiments\\image_designing\\env\\Lib\\site-packages\\PIL\\Image.py:3102\u001b[0m, in \u001b[0;36mfromarray\u001b[1;34m(obj, mode)\u001b[0m\n\u001b[0;32m 3100\u001b[0m typekey_shape, typestr \u001b[38;5;241m=\u001b[39m typekey\n\u001b[0;32m 3101\u001b[0m msg \u001b[38;5;241m=\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCannot handle this data type: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mtypekey_shape\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m, \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mtypestr\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m-> 3102\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(msg) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01me\u001b[39;00m\n\u001b[0;32m 3103\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 3104\u001b[0m rawmode \u001b[38;5;241m=\u001b[39m mode\n", + "\u001b[1;31mTypeError\u001b[0m: Cannot handle this data type: (1, 1, 3), " + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "data" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "env", + "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.12.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}