{"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":"# 1. Import the libraries","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19"}},{"cell_type":"code","source":"!pip install tensorflow","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:33:26.574770Z","iopub.execute_input":"2023-04-22T09:33:26.576243Z","iopub.status.idle":"2023-04-22T09:33:37.438348Z","shell.execute_reply.started":"2023-04-22T09:33:26.576189Z","shell.execute_reply":"2023-04-22T09:33:37.436947Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport tensorflow as tf\nfrom tensorflow.keras.preprocessing.image import ImageDataGenerator, load_img\nfrom tensorflow.keras.utils import to_categorical\nfrom sklearn.model_selection import train_test_split\nimport matplotlib.pyplot as plt\nimport random \nimport os","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:33:40.681371Z","iopub.execute_input":"2023-04-22T09:33:40.681794Z","iopub.status.idle":"2023-04-22T09:33:43.971926Z","shell.execute_reply.started":"2023-04-22T09:33:40.681754Z","shell.execute_reply":"2023-04-22T09:33:43.970648Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 2. Define Image properties","metadata":{}},{"cell_type":"code","source":"Image_width = 150\nImage_height = 150\nImage_size = (Image_width, Image_height)\nImage_channels = 3","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:33:46.269896Z","iopub.execute_input":"2023-04-22T09:33:46.270676Z","iopub.status.idle":"2023-04-22T09:33:46.277728Z","shell.execute_reply.started":"2023-04-22T09:33:46.270633Z","shell.execute_reply":"2023-04-22T09:33:46.276646Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 3. Prepare dataset for training model","metadata":{}},{"cell_type":"code","source":"# !cd /kaggle/input/dogs-vs-cats/train.zip","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:33:48.783401Z","iopub.execute_input":"2023-04-22T09:33:48.784273Z","iopub.status.idle":"2023-04-22T09:33:48.790009Z","shell.execute_reply.started":"2023-04-22T09:33:48.784212Z","shell.execute_reply":"2023-04-22T09:33:48.788643Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# !yes|unzip -q train.zip -d train","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:33:49.707802Z","iopub.execute_input":"2023-04-22T09:33:49.709098Z","iopub.status.idle":"2023-04-22T09:33:49.714453Z","shell.execute_reply.started":"2023-04-22T09:33:49.709041Z","shell.execute_reply":"2023-04-22T09:33:49.713203Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:33:51.211623Z","iopub.execute_input":"2023-04-22T09:33:51.212384Z","iopub.status.idle":"2023-04-22T09:33:51.221489Z","shell.execute_reply.started":"2023-04-22T09:33:51.212342Z","shell.execute_reply":"2023-04-22T09:33:51.220144Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!unzip -q \"/kaggle/input/dogs-vs-cats/test1.zip\"\n!unzip -q \"/kaggle/input/dogs-vs-cats/train.zip\"","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:33:52.244233Z","iopub.execute_input":"2023-04-22T09:33:52.244689Z","iopub.status.idle":"2023-04-22T09:34:03.388124Z","shell.execute_reply.started":"2023-04-22T09:33:52.244650Z","shell.execute_reply":"2023-04-22T09:34:03.386752Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ls","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:34:05.202881Z","iopub.execute_input":"2023-04-22T09:34:05.203973Z","iopub.status.idle":"2023-04-22T09:34:06.210852Z","shell.execute_reply.started":"2023-04-22T09:34:05.203912Z","shell.execute_reply":"2023-04-22T09:34:06.209247Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_dir = '/kaggle/working/train'\ntest_dir = '/kaggle/working/test1'","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:34:11.416308Z","iopub.execute_input":"2023-04-22T09:34:11.416770Z","iopub.status.idle":"2023-04-22T09:34:11.424786Z","shell.execute_reply.started":"2023-04-22T09:34:11.416726Z","shell.execute_reply":"2023-04-22T09:34:11.423749Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"categories = []\n\nfor f_name in filenames:\n    category = f_name.split('.')[0]\n    if category == 'dog':\n        categories.append(1)\n    else:\n        categories.append(0)\n        \ndf = pd.DataFrame({\n    'filename': filenames,\n    'category': categories\n})","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:34:13.212301Z","iopub.execute_input":"2023-04-22T09:34:13.213447Z","iopub.status.idle":"2023-04-22T09:34:13.222058Z","shell.execute_reply.started":"2023-04-22T09:34:13.213396Z","shell.execute_reply":"2023-04-22T09:34:13.220790Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 4. Create the neutral net model:","metadata":{}},{"cell_type":"code","source":"from tensorflow.keras.models import Sequential\nfrom tensorflow.keras.layers import (\n    BatchNormalization,Conv2D,MaxPooling2D,Dropout,Flatten,Dense\n)\nmodel = Sequential()\n\nmodel.add(Conv2D(32,(3,3),activation = 'relu',input_shape = (Image_width,Image_height,Image_channels)))\nmodel.add(BatchNormalization())\nmodel.add(MaxPooling2D(pool_size = (2,2)))\nmodel.add(Dropout(0.25))\n\nmodel.add(Conv2D(64,(3,3),activation = 'relu'))\nmodel.add(BatchNormalization())\nmodel.add(MaxPooling2D(pool_size = (2,2)))\nmodel.add(Dropout(0.25))\n\nmodel.add(Conv2D(128,(3,3),activation = 'relu'))\nmodel.add(BatchNormalization())\nmodel.add(MaxPooling2D(pool_size = (2,2)))\nmodel.add(Dropout(0.25))\n\nmodel.add(Flatten())\nmodel.add(Dense(512,activation = 'relu'))\nmodel.add(BatchNormalization())\nmodel.add(Dropout(0.5))\nmodel.add(Dense(2,activation = 'softmax'))\n\nmodel.compile(loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits = True),\n             optimizer = 'adam',metrics = ['accuracy'])","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:34:16.139802Z","iopub.execute_input":"2023-04-22T09:34:16.141099Z","iopub.status.idle":"2023-04-22T09:34:17.655358Z","shell.execute_reply.started":"2023-04-22T09:34:16.141056Z","shell.execute_reply":"2023-04-22T09:34:17.654245Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 5. Analyzing Model","metadata":{}},{"cell_type":"code","source":"model.summary()","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:34:20.334193Z","iopub.execute_input":"2023-04-22T09:34:20.334615Z","iopub.status.idle":"2023-04-22T09:34:20.382111Z","shell.execute_reply.started":"2023-04-22T09:34:20.334558Z","shell.execute_reply":"2023-04-22T09:34:20.381238Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 6. Define callbacks and learning rate:","metadata":{}},{"cell_type":"code","source":"from tensorflow.keras.callbacks import EarlyStopping,ReduceLROnPlateau\nearlystop = EarlyStopping(patience = 10)\nlearning_rate_reduction = ReduceLROnPlateau(monitor = 'val_acc',patience = 2,verbose = 1,factor = 0.5,min_lr = 0.00001)\ncallbacks = [earlystop,learning_rate_reduction]","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:34:22.650378Z","iopub.execute_input":"2023-04-22T09:34:22.651075Z","iopub.status.idle":"2023-04-22T09:34:22.659679Z","shell.execute_reply.started":"2023-04-22T09:34:22.651034Z","shell.execute_reply":"2023-04-22T09:34:22.657480Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 7. Manage Data","metadata":{}},{"cell_type":"code","source":"# create folders and move files\nif not os.path.exists((os.path.join(train_dir, 'cat'))):\n    os.mkdir(os.path.join(train_dir, 'cat'))\nif not os.path.exists((os.path.join(train_dir, 'dog'))):\n    os.mkdir(os.path.join(train_dir, 'dog'))\n\nfor file in os.listdir(train_dir):\n    if file[-3] == 'j':\n        if file[0] == 'c':\n            os.replace(os.path.join(train_dir,file), os.path.join(train_dir,'cat', file))\n        else:\n            os.replace(os.path.join(train_dir,file), os.path.join(train_dir,'dog', file))","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:34:26.305424Z","iopub.execute_input":"2023-04-22T09:34:26.306539Z","iopub.status.idle":"2023-04-22T09:34:27.477588Z","shell.execute_reply.started":"2023-04-22T09:34:26.306494Z","shell.execute_reply":"2023-04-22T09:34:27.476173Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"filenames = os.listdir('/kaggle/working/train')\n\ncategories = []\nfor f_name in filenames:\n    category = f_name.split('.')[0]\n    if category == 'dog':\n        categories.append(1)\n    else:\n        categories.append(0)\n        \ndf = pd.DataFrame({\n    'filename':filenames,\n    'category':categories\n})","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:34:29.575633Z","iopub.execute_input":"2023-04-22T09:34:29.577918Z","iopub.status.idle":"2023-04-22T09:34:29.585380Z","shell.execute_reply.started":"2023-04-22T09:34:29.577866Z","shell.execute_reply":"2023-04-22T09:34:29.584257Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df[\"category\"] = df[\"category\"].replace({0:'cat',1:'dog'})\ntrain_df,validate_df = train_test_split(df,test_size=0.20,\n  random_state=42)\ntrain_df = train_df.reset_index(drop=True)\nvalidate_df = validate_df.reset_index(drop=True)\ntotal_train=train_df.shape[0]\ntotal_validate=validate_df.shape[0]\nbatch_size=15","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:34:32.421492Z","iopub.execute_input":"2023-04-22T09:34:32.422682Z","iopub.status.idle":"2023-04-22T09:34:32.434829Z","shell.execute_reply.started":"2023-04-22T09:34:32.422634Z","shell.execute_reply":"2023-04-22T09:34:32.433712Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Batch_size = 100 # Number of trainin examples to process before updating our models variables\nImg_shape = 150 # Our training data consists of images with width of 150 pixels and height of 150 pixels","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:34:33.722430Z","iopub.execute_input":"2023-04-22T09:34:33.723178Z","iopub.status.idle":"2023-04-22T09:34:33.728614Z","shell.execute_reply.started":"2023-04-22T09:34:33.723139Z","shell.execute_reply":"2023-04-22T09:34:33.726942Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 8. Training and validation data generator:","metadata":{}},{"cell_type":"code","source":"image_generator = ImageDataGenerator(rescale=1./255, validation_split = 0.2)","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:35:59.216420Z","iopub.execute_input":"2023-04-22T09:35:59.217080Z","iopub.status.idle":"2023-04-22T09:35:59.224077Z","shell.execute_reply.started":"2023-04-22T09:35:59.217039Z","shell.execute_reply":"2023-04-22T09:35:59.221601Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data_gen = image_generator.flow_from_directory(\n    batch_size = Batch_size,\n    directory = train_dir,\n    shuffle = True,\n    target_size = (Img_shape,Img_shape), #(150,150)\n    class_mode = 'binary',\n    subset = 'training'\n)\n\nval_data_gen = image_generator.flow_from_directory(\n    batch_size = Batch_size,\n    directory = train_dir,\n    shuffle = False,\n    target_size = (Img_shape,Img_shape), #(150,150)\n    class_mode = 'binary',\n    subset = 'validation'\n)","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:36:00.731806Z","iopub.execute_input":"2023-04-22T09:36:00.732900Z","iopub.status.idle":"2023-04-22T09:36:01.439835Z","shell.execute_reply.started":"2023-04-22T09:36:00.732836Z","shell.execute_reply":"2023-04-22T09:36:01.438300Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 9. Model Training","metadata":{}},{"cell_type":"code","source":"epochs = 10\nhistory = model.fit_generator(\n    train_data_gen,\n    epochs = epochs,\n    validation_data = val_data_gen,\n    steps_per_epoch = int(np.ceil(20000 / float(Batch_size))), #batch_size\n    validation_steps = int(np.ceil(5000 / float(Batch_size))) #batch_size\n#     callbacks = callbacks\n)","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:36:04.171716Z","iopub.execute_input":"2023-04-22T09:36:04.172471Z","iopub.status.idle":"2023-04-22T09:49:24.210249Z","shell.execute_reply.started":"2023-04-22T09:36:04.172430Z","shell.execute_reply":"2023-04-22T09:49:24.209108Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 10. Visualize Results of the training","metadata":{}},{"cell_type":"code","source":"acc = history.history['accuracy']\nval_acc = history.history['val_accuracy']\n\nloss = history.history['loss']\nval_loss = history.history['val_loss']\n\nepochs_range = range(epochs)\n\nplt.figure(figsize = (8,8))\nplt.subplot(1,2,1)\nplt.plot(epochs_range,acc,label = 'Training Accuracy')\nplt.plot(epochs_range,val_acc,label = 'Validation Accuracy')\nplt.legend(loc = 'lower right')\nplt.title('Training and Validation Accuracy')\n\nplt.subplot(1,2,2)\nplt.plot(epochs_range,loss,label = 'Training Loss')\nplt.plot(epochs_range,val_loss,label = 'Validation Loss')\nplt.legend(loc = 'upper right')\nplt.title('Training and Validation Loss')\nplt.savefig('foo.png')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:49:28.187459Z","iopub.execute_input":"2023-04-22T09:49:28.188689Z","iopub.status.idle":"2023-04-22T09:49:28.677613Z","shell.execute_reply.started":"2023-04-22T09:49:28.188623Z","shell.execute_reply":"2023-04-22T09:49:28.676551Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 11. Save the model","metadata":{}},{"cell_type":"code","source":"model.save('model1_DogsVsCats_epoch10.h5')","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:49:32.741667Z","iopub.execute_input":"2023-04-22T09:49:32.742741Z","iopub.status.idle":"2023-04-22T09:49:33.659074Z","shell.execute_reply.started":"2023-04-22T09:49:32.742702Z","shell.execute_reply":"2023-04-22T09:49:33.657019Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 12. Test data preparation","metadata":{}},{"cell_type":"code","source":"test_filenames = os.listdir(\"/kaggle/working/test1\")\ntest_df = pd.DataFrame({\n    'filename': test_filenames\n})\nnb_samples = test_df.shape[0]","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:49:35.937910Z","iopub.execute_input":"2023-04-22T09:49:35.939257Z","iopub.status.idle":"2023-04-22T09:49:35.954639Z","shell.execute_reply.started":"2023-04-22T09:49:35.939198Z","shell.execute_reply":"2023-04-22T09:49:35.953178Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 13. Make categorical prediction:","metadata":{}},{"cell_type":"code","source":"test_data_gen = image_generator.flow_from_directory(\n    batch_size = Batch_size,\n    directory = test_dir,\n    shuffle = True,\n    target_size = (Img_shape,Img_shape), #(150,150)\n    class_mode = 'binary',\n    subset = 'training'\n)\n\nval_data_gen = image_generator.flow_from_directory(\n    batch_size = Batch_size,\n    directory = test_dir,\n    shuffle = False,\n    target_size = (Img_shape,Img_shape), #(150,150)\n    class_mode = 'binary',\n    subset = 'validation'\n)","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:50:27.063675Z","iopub.execute_input":"2023-04-22T09:50:27.064882Z","iopub.status.idle":"2023-04-22T09:50:27.554459Z","shell.execute_reply.started":"2023-04-22T09:50:27.064825Z","shell.execute_reply":"2023-04-22T09:50:27.553349Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# predict = model.predict_generator(test_data_gen,steps = np.ceil(nb_samples/batch_size))","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:51:04.787515Z","iopub.execute_input":"2023-04-22T09:51:04.788695Z","iopub.status.idle":"2023-04-22T09:51:34.395358Z","shell.execute_reply.started":"2023-04-22T09:51:04.788640Z","shell.execute_reply":"2023-04-22T09:51:34.394287Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 14. Converts labels to Categories","metadata":{}},{"cell_type":"code","source":"# test_df['category'] = np.argmax(predict, axis = 1)\n\n# label_map = dict((v,k) for k,v in train_data_gen.class_indices.items())\n# test_df['category'] = test_df['category'].replace(label_map)\n\n# test_df['category'] = test_df['category'].replace({'dog':1,'cat':0})","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:51:37.105074Z","iopub.execute_input":"2023-04-22T09:51:37.105779Z","iopub.status.idle":"2023-04-22T09:51:37.110772Z","shell.execute_reply.started":"2023-04-22T09:51:37.105739Z","shell.execute_reply":"2023-04-22T09:51:37.109586Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 15. Visualize the Prediction Results:","metadata":{}},{"cell_type":"code","source":"# sample_test = test_dir\n# # sample_test.head()\n# plt.figure(figsize = (12,24))\n# for index,row in sample_test.iterrows():\n#     filename = row['filename']\n#     category = row['category']\n#     img = load_img('/kaggle/working/test1' + filename,target_size = Image_size)\n#     plt.subplot(6,3,index+1)\n#     plt.imshow(img)\n#     plt.xlabel(filename+'('+'{}'.format(category)+')')\n# plt.tight_layout()\n# plt.show()","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:51:39.013354Z","iopub.execute_input":"2023-04-22T09:51:39.013993Z","iopub.status.idle":"2023-04-22T09:51:39.020436Z","shell.execute_reply.started":"2023-04-22T09:51:39.013953Z","shell.execute_reply":"2023-04-22T09:51:39.018796Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 16. Test your model on custom data:","metadata":{}},{"cell_type":"code","source":"# results = {\n#     0:'cat',\n#     1:'dog'\n# }\n# from PIL import Image\n# import numpy as np\n# im = Image.open(\"_image_path_TO_custom_image\")\n# im = im.resize(Image_Size)\n# im = np.expand_dims(im,axis = 0)\n# im = np.array(im)\n# im = im/255\n# pred = model.predict_classes([im])[0]\n# print(pred,results[pred])","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:51:41.009858Z","iopub.execute_input":"2023-04-22T09:51:41.010387Z","iopub.status.idle":"2023-04-22T09:51:41.015628Z","shell.execute_reply.started":"2023-04-22T09:51:41.010346Z","shell.execute_reply":"2023-04-22T09:51:41.014431Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 17. Dogs Vs Cats Calssifier GUI:","metadata":{}},{"cell_type":"code","source":"# import tkinter as tk\n# from tkinter import filedialog\n# from tkinter import *\n# from PIL import ImageTk, Image\n# import numpy\n\n# from tensorflow.keras.models import load_model\n# model = load_model('model1_DogsVsCats_epoch10.h5')\n# #dictionary to label all traffic signs class.\n# classes = { \n#     0:'its a cat',\n#     1:'its a dog',\n \n# }\n# #initialise GUI\n# top=tk.Tk()\n# top.geometry('800x600')\n# top.title('CatsVSDogs Classification')\n# top.configure(background='#CDCDCD')\n# label=Label(top,background='#CDCDCD', font=('arial',15,'bold'))\n# sign_image = Label(top)\n# def classify(file_path):\n#     global label_packed\n#     image = Image.open(file_path)\n#     image = image.resize((128,128))\n#     image = numpy.expand_dims(image, axis=0)\n#     image = numpy.array(image)\n#     image = image/255\n#     pred = model.predict_classes([image])[0]\n#     sign = classes[pred]\n#     print(sign)\n#     label.configure(foreground='#011638', text=sign) \n# def show_classify_button(file_path):\n#     classify_b=Button(top,text=\"Classify Image\",\n#    command=lambda: classify(file_path),\n#    padx=10,pady=5)\n#     classify_b.configure(background='#364156', foreground='white',\n# font=('arial',10,'bold'))\n#     classify_b.place(relx=0.79,rely=0.46)\n\n# def upload_image():\n#     try:\n#         file_path=filedialog.askopenfilename()\n#         uploaded=Image.open(file_path)\n#         uploaded.thumbnail(((top.winfo_width()/2.25),\n#     (top.winfo_height()/2.25)))\n#         im=ImageTk.PhotoImage(uploaded)\n#         sign_image.configure(image=im)\n#         sign_image.image=im\n#         label.configure(text='')\n#         show_classify_button(file_path)\n#     except:\n#         pass\n# upload=Button(top,text=\"Upload an image\",command=upload_image,padx=10,pady=5)\n# upload.configure(background='#364156', foreground='white',font=('arial',10,'bold'))\n# upload.pack(side=BOTTOM,pady=50)\n# sign_image.pack(side=BOTTOM,expand=True)\n# label.pack(side=BOTTOM,expand=True)\n# heading = Label(top, text=\"CatsVSDogs Classification\",pady=20, font=('arial',20,'bold'))\n# heading.configure(background='#CDCDCD',foreground='#364156')\n# heading.pack()\n# top.mainloop()","metadata":{"execution":{"iopub.status.busy":"2023-04-22T09:52:56.064428Z","iopub.execute_input":"2023-04-22T09:52:56.065561Z","iopub.status.idle":"2023-04-22T09:52:56.074165Z","shell.execute_reply.started":"2023-04-22T09:52:56.065518Z","shell.execute_reply":"2023-04-22T09:52:56.072867Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}