<jupyter_start><jupyter_text><jupyter_code># Import PyDrive and associated libraries.
# This only needs to be done once per notebook.
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials

# Authenticate and create the PyDrive client.
# This only needs to be done once per notebook.
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)


fid = drive.ListFile({'q':"title='dataset.zip'"}).GetList()[0]['id']
f = drive.CreateFile({'id': fid})
f.GetContentFile('dataset.zip')

!unzip "/content/dataset.zip"
path =os.getcwd()
import glob
file_list = glob.glob(os.path.join(path,'dataset/*.jpg'))
len(file_list)
from keras.applications import vgg16
from keras.preprocessing.image import load_img,img_to_array
from keras.models import Model
from keras.applications.imagenet_utils import preprocess_input
from tensorflow.python.keras.applications import vgg16

import time
import os
import matplotlib.pyplot as plt
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
import pandas as pd
nb_closest_images = 5
given_image = 

def load_trained_model():
    vgg_model = vgg16.VGG16(weights='imagenet')
    feature_extractor = Model(inputs=vgg_model.input, outputs=vgg_model.get_layer('fc2').output)
    feature_extractor.summary()
    return feature_extractor<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09562289562289562, 'fraction_numerical': 0.00808080808080808, 'mean_word_length': 6.43, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '210834', 'license': 'Apache-2.0', 'n_tokens_mistral': 487, 'n_tokens_neox': 473, 'n_words': 121, 'path': 'Similarity_based_image_recommender.ipynb', 'repo_name': 'abdulazeem/AWS---Chandralingam', 'size': '1485'}