Skip to content

Commit

Permalink
Fixed demo.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
mantasu committed Mar 6, 2024
1 parent cb2f076 commit c253c68
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions notebooks/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"import yaml\n",
"import pickle\n",
"import numpy as np\n",
"from PIL import Image as Image\n",
"from PIL import Image\n",
"\n",
"# TODO: uncomment when Colab supports Python 3.12\n",
"# from glasses_detector import GlassesClassifier, GlassesDetector, GlassesSegmenter\n",
Expand All @@ -98,12 +98,12 @@
"def display_images_in_row(directory, padding=10, sort=False):\n",
" # Load all images in the directory\n",
" files = sorted(os.listdir(directory)) if sort else os.listdir(directory)\n",
" images = [PILImage.open(os.path.join(directory, img)) for img in files]\n",
" images = [Image.open(os.path.join(directory, img)) for img in files]\n",
"\n",
" # Create a new image with enough width to hold all images and padding\n",
" total_width = sum(img.width for img in images) + padding * (len(images) - 1)\n",
" max_height = max(img.height for img in images)\n",
" new_img = PILImage.new(\"RGB\", (total_width, max_height))\n",
" new_img = Image.new(\"RGB\", (total_width, max_height))\n",
"\n",
" # Paste images into new image with padding\n",
" x = 0\n",
Expand Down

0 comments on commit c253c68

Please sign in to comment.