{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"<div style=\"color:white;\n           display:fill;\n           border-radius:2px;\n           background-color:Black;\n           font-size:250%;\n           font-family:Verdana;\n           letter-spacing:0.5px\">\n<p style=\"padding: 10px;\n          text-align: center;\n          font-size:150%;\n          color:brown;\">\n           🎨Image Recommendation System📊\n</p>\n<style>\n        h1{text-align: center;}\n </style>  \n    \n</div> ","metadata":{}},{"cell_type":"code","source":"!pip install swifter\n!pip install torchvision","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:38:09.955775Z","iopub.execute_input":"2022-11-11T16:38:09.956776Z","iopub.status.idle":"2022-11-11T16:38:32.978860Z","shell.execute_reply.started":"2022-11-11T16:38:09.956630Z","shell.execute_reply":"2022-11-11T16:38:32.977571Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<div style=\"color:white;\n           display:fill;\n           border-radius:5px;\n           background-color:red;\n           font-size:250%;\n           font-family:Verdana;\n           letter-spacing:0.5px\">\n\n<p style=\"padding:3px;\n          text-align: center;\n          font-size:150%;\n          color:black;\">\n           📚📚Importing Libraries<span style='font-size:50px;'>&#128295;</span>\n</p>\n<style>\n        h1{text-align: center;}\n </style>  ","metadata":{}},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport torch\nfrom torch import nn\nimport torchvision\nfrom torchvision import datasets\nimport cv2\nimport joblib\nfrom sklearn.metrics.pairwise import cosine_similarity\nfrom pandas.core.common import flatten\nfrom torchvision.transforms import transforms\nimport torchvision.models as models\nfrom torch.autograd import variable\n#from transforms import det_transforms\nimport torchvision.transforms as transforms\nimport swifter","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:38:32.981831Z","iopub.execute_input":"2022-11-11T16:38:32.982231Z","iopub.status.idle":"2022-11-11T16:38:35.066592Z","shell.execute_reply.started":"2022-11-11T16:38:32.982189Z","shell.execute_reply":"2022-11-11T16:38:35.065305Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv('../input/fashion-product-images-dataset/fashion-dataset/styles.csv',error_bad_lines=False,warn_bad_lines=False)","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:38:35.068105Z","iopub.execute_input":"2022-11-11T16:38:35.068623Z","iopub.status.idle":"2022-11-11T16:38:35.170522Z","shell.execute_reply.started":"2022-11-11T16:38:35.068561Z","shell.execute_reply":"2022-11-11T16:38:35.169273Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['image'] = df.apply(lambda row:str(row['id'])+'.jpg',axis=1)\ndf = df.reset_index(drop=True)","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:38:35.171868Z","iopub.execute_input":"2022-11-11T16:38:35.172232Z","iopub.status.idle":"2022-11-11T16:38:35.700660Z","shell.execute_reply.started":"2022-11-11T16:38:35.172198Z","shell.execute_reply":"2022-11-11T16:38:35.699310Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<div style=\"color:white;\n           display:fill;\n           border-radius:5px;\n           background-color:yellow;\n           font-size:250%;\n           font-family:Verdana;\n           letter-spacing:0.5px\">\n\n<p style=\"padding:3px;\n          text-align: center;\n          font-size:150%;\n          color:black;\">\n           Function to locate and load image\n</p>\n<style>\n        h1{text-align: center;}\n </style>  ","metadata":{}},{"cell_type":"code","source":"# Function to load the path\ndef image_location(img):\n    #print(\"Hi-1\",img)\n    path = \"../input/fashion-product-images-dataset/fashion-dataset/images/\"\n    #print(path)\n    fin = path+img\n    #print(\"HIIII\",fin)\n    return fin","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:38:35.703784Z","iopub.execute_input":"2022-11-11T16:38:35.704164Z","iopub.status.idle":"2022-11-11T16:38:35.709321Z","shell.execute_reply.started":"2022-11-11T16:38:35.704122Z","shell.execute_reply":"2022-11-11T16:38:35.708084Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def import_img(image):\n    #print(\"Hi-2\",image)\n    imag = cv2.imread(image_location(image))\n    #print(\"Hi-3\",image)\n    #print(\"isis\",plt.imread(image_location(image)))\n    return imag","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:38:35.710914Z","iopub.execute_input":"2022-11-11T16:38:35.711883Z","iopub.status.idle":"2022-11-11T16:38:35.722953Z","shell.execute_reply.started":"2022-11-11T16:38:35.711841Z","shell.execute_reply":"2022-11-11T16:38:35.721653Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<div style=\"color:white;\n           display:fill;\n           border-radius:5px;\n           background-color:orange;\n           font-size:250%;\n           font-family:Verdana;\n           letter-spacing:0.5px\">\n\n<p style=\"padding:3px;\n          text-align: center;\n          font-size:150%;\n          color:black;\">\n           📚📚Plotting Images<span style='font-size:50px;'>&#128295;</span>\n</p>\n<style>\n        h1{text-align: center;}\n </style>  ","metadata":{}},{"cell_type":"code","source":"from PIL import Image\n\nimport warnings\nwarnings.filterwarnings(\"ignore\")\n\n# Function to view image\ndef show_images(images,rows = 1,cols=1,figsize=(12, 12)):\n    #define fig\n    fig,axes = plt.subplots(ncols=cols,nrows=rows,figsize=figsize)\n\n    \n    for index,name in enumerate(images):\n        #print(images)\n        \n        \n        axes.ravel()[index].imshow(cv2.cvtColor(images[name],cv2.COLOR_BGR2RGB))\n     \n        axes.ravel()[index].set_title(name)\n        axes.ravel()[index].set_axis_off()\n    #plot\nplt.tight_layout()","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:38:35.724806Z","iopub.execute_input":"2022-11-11T16:38:35.726032Z","iopub.status.idle":"2022-11-11T16:38:35.743389Z","shell.execute_reply.started":"2022-11-11T16:38:35.725988Z","shell.execute_reply":"2022-11-11T16:38:35.741812Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nfigures = {'im'+str(i):import_img(row.image) for i, row in df.sample(6).iterrows()}\n","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:38:35.745027Z","iopub.execute_input":"2022-11-11T16:38:35.745523Z","iopub.status.idle":"2022-11-11T16:38:36.111581Z","shell.execute_reply.started":"2022-11-11T16:38:35.745465Z","shell.execute_reply":"2022-11-11T16:38:36.110357Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"show_images(figures,2,3)","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:38:36.113181Z","iopub.execute_input":"2022-11-11T16:38:36.113690Z","iopub.status.idle":"2022-11-11T16:38:40.286863Z","shell.execute_reply.started":"2022-11-11T16:38:36.113633Z","shell.execute_reply":"2022-11-11T16:38:40.285797Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<div style=\"color:white;\n           display:fill;\n           border-radius:5px;\n           background-color:#40826D;\n           font-size:200%;\n           font-family:Verdana;\n           letter-spacing:0.5px\">\n\n<p style=\"padding:3px;\n          text-align: center;\n          font-size:150%;\n          color:blue;\">          \n           🧾📑Data Pre-processing <span style='font-size:50px;'>&#128215;</span>\n</p>\n<style>\n        h1{text-align: center;}\n </style>  ","metadata":{}},{"cell_type":"code","source":"#ResNet18 PyTorch model to convert\n\n# We will use resent architecture for our work as the name suggest it has 18 layers altogether ith layers of convolution in it\n# It has been trained on million of images that are extracted from imagenet dataset it has capacity to classify over 1000 class objects\n\n# Definning the input shape\nwidth = 224\nHeight = 224\n\n# Lets load the pre-trained model\nresnetmodel = models.resnet18(pretrained=True)\n# Selecting the layer \nlayer = resnetmodel._modules.get('avgpool')\n\n# Lets now extract the embeded vectore from the image and save it in the singe object\ns_data = transforms.Resize((224, 224))","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:38:40.288497Z","iopub.execute_input":"2022-11-11T16:38:40.289488Z","iopub.status.idle":"2022-11-11T16:38:40.535212Z","shell.execute_reply.started":"2022-11-11T16:38:40.289446Z","shell.execute_reply":"2022-11-11T16:38:40.534334Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Normailizing the data\nstandardize = transforms.Normalize(mean=[0.7, 0.6, 0.3],std=[0.2, 0.3, 0.1])\n# Converting the tensor\nConvert_tensor = transforms.ToTensor()\n# creating the missing object\nmissing_img =[]","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:38:40.536822Z","iopub.execute_input":"2022-11-11T16:38:40.537497Z","iopub.status.idle":"2022-11-11T16:38:40.542367Z","shell.execute_reply.started":"2022-11-11T16:38:40.537458Z","shell.execute_reply":"2022-11-11T16:38:40.541506Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#function to get embeddings\ndef vector_extraction(resnetmodel,image_id):\n    # Exception to handle missing images \n    try:\n        img = Image.open(image_location(image_id)).convert('RGB')\n        \n        t_img = variable(standardize(Convert_tensor(s_data(img))).unsqueeze(0))\n       \n        embeddings = torch.zeros(512)\n        #print('H',embeddings)\n        def select_d(m, i, o):\n            embeddings.copy_(o.data.reshape(o.data.size(1)))\n        hlayer = layer.register_forward_hook(select_d)\n        resnetmodel(t_img)\n        hlayer.remove()\n        emb = embeddings\n        return embeddings   \n        \n    except FileNotFoundError:\n        # Store the index of missing img list in the missing_img list and later we can look in\n        missing_img = df[df['image']==image_id].index\n        #print(missing_img)\n        missing_img.append(missing_img)\n        ","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:38:40.543788Z","iopub.execute_input":"2022-11-11T16:38:40.544128Z","iopub.status.idle":"2022-11-11T16:38:40.557959Z","shell.execute_reply.started":"2022-11-11T16:38:40.544096Z","shell.execute_reply":"2022-11-11T16:38:40.556327Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_embedding_0 = vector_extraction(resnetmodel,df.iloc[0].image)\n# Plotting the sample image and its embeddings\nimg_array = import_img(df.iloc[0].image)\nplt.imshow(cv2.cvtColor(img_array, cv2.COLOR_BGR2RGB))\nprint(img_array.shape)\n#print(sample_embedding_0)","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:38:40.559918Z","iopub.execute_input":"2022-11-11T16:38:40.560317Z","iopub.status.idle":"2022-11-11T16:38:41.726658Z","shell.execute_reply.started":"2022-11-11T16:38:40.560284Z","shell.execute_reply":"2022-11-11T16:38:41.725388Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nsample_embedding_1 = vector_extraction(resnetmodel,df.iloc[1001].image)\n#print(\"The image is\",df.iloc[1001].image)\n# Plotting the sample image and its embeddings\nimg_array = import_img(df.iloc[1001].image)\n#print(img_array)\nplt.imshow(cv2.cvtColor(img_array, cv2.COLOR_BGR2RGB))\nprint(img_array.shape)\n#print(sample_embedding_1)","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:38:41.730959Z","iopub.execute_input":"2022-11-11T16:38:41.731355Z","iopub.status.idle":"2022-11-11T16:38:42.355058Z","shell.execute_reply.started":"2022-11-11T16:38:41.731321Z","shell.execute_reply":"2022-11-11T16:38:42.353967Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<div style=\"color:white;\n           display:fill;\n           border-radius:5px;\n           background-color:green;\n           font-size:200%;\n           font-family:Verdana;\n           letter-spacing:0.5px\">\n\n<p style=\"padding:3px;\n          text-align: center;\n          font-size:150%;\n          color:blue;\">          \n           🧾📑Simialrity Calculation for similar image  <span style='font-size:50px;'>&#128215;</span>\n</p>\n<style>\n        h1{text-align: center;}\n </style>  ","metadata":{}},{"cell_type":"code","source":"cos = nn.CosineSimilarity(dim=1, eps=1e-6)\ncos_sim = cos(sample_embedding_0.unsqueeze(0),sample_embedding_1.unsqueeze(0))\nprint('\\nCosine similarity: {0}\\n'.format(cos_sim))","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:38:42.356326Z","iopub.execute_input":"2022-11-11T16:38:42.356646Z","iopub.status.idle":"2022-11-11T16:38:42.363507Z","shell.execute_reply.started":"2022-11-11T16:38:42.356615Z","shell.execute_reply":"2022-11-11T16:38:42.362620Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<div style=\"color:white;\n           display:fill;\n           border-radius:5px;\n           background-color:blue;\n           font-size:200%;\n           font-family:Verdana;\n           letter-spacing:0.5px\">\n\n<p style=\"padding:3px;\n          text-align: center;\n          font-size:150%;\n          color:black;\">          \n           🧾📑Taking subset of data <span style='font-size:50px;'>&#128215;</span>\n</p>\n<style>\n        h1{text-align: center;}\n </style>  ","metadata":{}},{"cell_type":"code","source":"df_embeddings = df[:5000]\n","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:38:42.364803Z","iopub.execute_input":"2022-11-11T16:38:42.365174Z","iopub.status.idle":"2022-11-11T16:38:42.375554Z","shell.execute_reply.started":"2022-11-11T16:38:42.365141Z","shell.execute_reply":"2022-11-11T16:38:42.374324Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# looping through images to get the embeddings\nmap_embeddings = df_embeddings['image'].swifter.apply(lambda img:vector_extraction(resnetmodel,img))","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:38:42.377117Z","iopub.execute_input":"2022-11-11T16:38:42.377473Z","iopub.status.idle":"2022-11-11T16:50:20.754904Z","shell.execute_reply.started":"2022-11-11T16:38:42.377440Z","shell.execute_reply":"2022-11-11T16:50:20.753702Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_embs = map_embeddings.apply(pd.Series)\ndf_embs.to_csv('fashion.csv')\ndf_embs = pd.read_csv('./fashion.csv')\ndf_emb1s = df_embs.drop(['Unnamed: 0'],axis=1,inplace=True)\ndf_embs.dropna(inplace=True)\n# Exporting it as a pikel\njoblib.dump(df_embs,'df_embs.pkl',9)\n# To load the pikel\ndf_embss = joblib.load('./df_embs.pkl')","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:50:20.756394Z","iopub.execute_input":"2022-11-11T16:50:20.757515Z","iopub.status.idle":"2022-11-11T16:50:26.342289Z","shell.execute_reply.started":"2022-11-11T16:50:20.757465Z","shell.execute_reply":"2022-11-11T16:50:26.341357Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cosine_sim = cosine_similarity(df_embss)\ncosine_sim[:4,:4]","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:50:26.343413Z","iopub.execute_input":"2022-11-11T16:50:26.343952Z","iopub.status.idle":"2022-11-11T16:50:26.714896Z","shell.execute_reply.started":"2022-11-11T16:50:26.343918Z","shell.execute_reply":"2022-11-11T16:50:26.713307Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# lets define a function that gives recomendation of the image based on the cosine similarity\nindex_values = pd.Series(range(len(df)),index=df.index)","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:50:26.717026Z","iopub.execute_input":"2022-11-11T16:50:26.717940Z","iopub.status.idle":"2022-11-11T16:50:26.727416Z","shell.execute_reply.started":"2022-11-11T16:50:26.717875Z","shell.execute_reply":"2022-11-11T16:50:26.725486Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<div style=\"color:white;\n           display:fill;\n           border-radius:5px;\n           background-color:gold;\n           font-size:200%;\n           font-family:Verdana;\n           letter-spacing:0.5px\">\n\n<p style=\"padding:3px;\n          text-align: center;\n          font-size:150%;\n          color:black;\">          \n          <span style='font-size:50px;'>&#128221;</span> Recommend Images<span style='font-size:50px;'>&#128227;</span>\n</p>\n<style>\n        h1{text-align: center;}\n </style>  \n    \n</div>","metadata":{}},{"cell_type":"code","source":"def recommend_images(ImId,df,top_n=6):\n    sim_ImID = index_values[ImId]\n    print(sim_ImID)\n    sml_scr = list(enumerate(cosine_sim[sim_ImID]))\n    sml_scr = sorted(sml_scr,key = lambda x:x[1],reverse = True)\n    sml_scr = sml_scr[1:top_n+1]\n    # ImId_rec will return the index of similar items\n    ImId_rec = [i[0] for i in sml_scr]\n    ImId_sim = [i[1] for i in sml_scr]\n    return index_values.iloc[ImId_rec].index,ImId_sim","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:50:26.730588Z","iopub.execute_input":"2022-11-11T16:50:26.732079Z","iopub.status.idle":"2022-11-11T16:50:26.745891Z","shell.execute_reply.started":"2022-11-11T16:50:26.732016Z","shell.execute_reply":"2022-11-11T16:50:26.744843Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"recommend_images(3810, df, top_n = 5)","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:50:26.747401Z","iopub.execute_input":"2022-11-11T16:50:26.747745Z","iopub.status.idle":"2022-11-11T16:50:26.762973Z","shell.execute_reply.started":"2022-11-11T16:50:26.747714Z","shell.execute_reply":"2022-11-11T16:50:26.761810Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def Rec_viz_image(input_imageid):\n    # Getting recommendations\n    idx_rec, idx_sim = recommend_images(input_imageid, df, top_n = 6)\n    plt.imshow(cv2.cvtColor(import_img(df.iloc[input_imageid].image), cv2.COLOR_BGR2RGB))\n    figures = {'im'+str(i): import_img(row.image) for i, row in df.loc[idx_rec].iterrows()}\n    show_images(figures, 2, 3)","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:50:26.764296Z","iopub.execute_input":"2022-11-11T16:50:26.764650Z","iopub.status.idle":"2022-11-11T16:50:26.774135Z","shell.execute_reply.started":"2022-11-11T16:50:26.764618Z","shell.execute_reply":"2022-11-11T16:50:26.772727Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Rec_viz_image(4810)","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:50:26.775894Z","iopub.execute_input":"2022-11-11T16:50:26.776316Z","iopub.status.idle":"2022-11-11T16:50:29.275417Z","shell.execute_reply.started":"2022-11-11T16:50:26.776279Z","shell.execute_reply":"2022-11-11T16:50:29.274239Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Rec_viz_image(2518)","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:50:29.277215Z","iopub.execute_input":"2022-11-11T16:50:29.277612Z","iopub.status.idle":"2022-11-11T16:50:32.589382Z","shell.execute_reply.started":"2022-11-11T16:50:29.277576Z","shell.execute_reply":"2022-11-11T16:50:32.588079Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<div style=\"color:white;\n           display:fill;\n           border-radius:5px;\n           background-color:lightblue;\n           font-size:200%;\n           font-family:Verdana;\n           letter-spacing:0.5px\">\n\n<p style=\"padding:3px;\n          text-align: center;\n          font-size:150%;\n          color:black;\">          \n          <span style='font-size:50px;'>&#128221;</span> Recommend User Input <span style='font-size:50px;'>&#128227;</span>\n</p>\n<style>\n        h1{text-align: center;}\n </style>  \n    \n</div>","metadata":{}},{"cell_type":"code","source":"#function to get embeddings\ndef recm_user_input(image_id):\n    \n    # Exception to handle missing images \n    \n    img = Image.open('../input/wasasasa/'+image_id).convert('RGB')\n        \n    t_img = variable(standardize(Convert_tensor(s_data(img))).unsqueeze(0))\n       \n    embeddings = torch.zeros(512)\n        #print('H',embeddings)\n    def select_d(m, i, o):\n        embeddings.copy_(o.data.reshape(o.data.size(1)))\n    hlayer = layer.register_forward_hook(select_d)\n    resnetmodel(t_img)\n    hlayer.remove()\n    emb = embeddings\n    \n    cs = cosine_similarity(emb.unsqueeze(0),df_embss)\n    cs_list = list(flatten(cs))\n    cs_df = pd.DataFrame(cs_list,columns=['Score'])\n    cs_df = cs_df.sort_values(by=['Score'],ascending=False)\n        \n# Printing Cosine Similarity\n    print(cs_df['Score'][:10])\n    # Extracting the index of top 10 similar items/images\n    top10 = cs_df[:10].index\n    top10 = list(flatten(top10))\n    images_list = []\n    for i in top10:\n        image_id = df[df.index==i]['image']\n        print(image_id)\n        images_list.append(image_id)\n    images_list = list(flatten(images_list))\n    print(images_list)\n    \n    # Plotting the image of item requested by user\n    print(\"Hi\",image_id)\n    #img_print =Image.open('../input/afsfssgg/'+image_id)\n    #print(img_print)\n    #plt.imshow(img_print)\n# Generating a dictionary { index, image }\n    figures = {'im'+str(i): Image.open('../input/fashion-product-images-dataset/fashion-dataset/images/' + i) for i in images_list}\n    fig, axes = plt.subplots(2, 5, figsize = (8,8) )\n    for index,name in enumerate(figures):\n        axes.ravel()[index].imshow(figures[name])\n        axes.ravel()[index].set_title(name)\n        axes.ravel()[index].set_axis_off()\n    plt.tight_layout()\n\n        #return embeddings   \n    figures = {'im'+str(i):import_img(row.image) for i, row in df.sample(6).iterrows()}\n\n","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:52:52.302080Z","iopub.execute_input":"2022-11-11T16:52:52.303425Z","iopub.status.idle":"2022-11-11T16:52:52.317746Z","shell.execute_reply.started":"2022-11-11T16:52:52.303377Z","shell.execute_reply":"2022-11-11T16:52:52.316527Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<div style=\"color:white;\n           display:fill;\n           border-radius:5px;\n           background-color:pink;\n           font-size:200%;\n           font-family:Verdana;\n           letter-spacing:0.5px\">\n\n<p style=\"padding:3px;\n          text-align: center;\n          font-size:150%;\n          color:black;\">          \n          <span style='font-size:50px;'>&#128221;</span> Checking the recommendation system output <span style='font-size:50px;'>&#128227;</span>\n</p>\n<style>\n        h1{text-align: center;}\n </style>  \n    \n</div>","metadata":{}},{"cell_type":"code","source":"recm_user_input('1-lk-1126-blue-dial-brown-strap-date-day-lowkey-men-original-imagg3gcugfzxbqn.jpeg')","metadata":{"execution":{"iopub.status.busy":"2022-11-11T16:52:56.359672Z","iopub.execute_input":"2022-11-11T16:52:56.360135Z","iopub.status.idle":"2022-11-11T16:53:01.207587Z","shell.execute_reply.started":"2022-11-11T16:52:56.360099Z","shell.execute_reply":"2022-11-11T16:53:01.206582Z"},"trusted":true},"execution_count":null,"outputs":[]}]}