Skip to content

Commit

Permalink
remove skimage from models
Browse files Browse the repository at this point in the history
  • Loading branch information
ryaanahmed committed Sep 15, 2023
1 parent 4c21e84 commit 4532566
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions backend/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from pathlib import Path

from skimage import io
from PIL import Image

from django.db import models
Expand Down Expand Up @@ -45,7 +44,7 @@ class Photo(models.Model):
full_text = models.TextField(null=True, blank=True)
location = models.CharField(max_length=252, null=True, blank=True)

def get_image_data(self, as_gray=False, use_pillow=False, photos_dir=settings.LOCAL_PHOTOS_DIR):
def get_image_data(self, as_gray=False, photos_dir=settings.LOCAL_PHOTOS_DIR):
"""
Get the image data via skimage's imread, for use in analyses
Expand All @@ -55,10 +54,7 @@ def get_image_data(self, as_gray=False, use_pillow=False, photos_dir=settings.LO
TODO: implement as_gray for use_pillow
"""
photo_path = self.image_local_filepath(photos_dir=photos_dir)
if use_pillow:
image = Image.open(photo_path)
else:
image = io.imread(photo_path, as_gray)
image = Image.open(photo_path)

return image

Expand Down

0 comments on commit 4532566

Please sign in to comment.