INNER CODE UNIT · Python

_retrieve_row

patrickjohncyh/fashion-clip · fashion_clip/fashion_clip.py:79

    def _retrieve_row(self, id: str):
        return self.catalog[self.id_to_idx[id]]

    # def get_metadata(self, id, fields=['caption', 'price']):
    #     pass
    def _hash_list(self, l: List[str]):
        l_hash = map(lambda el: hashlib.sha256(str(el).encode()).hexdigest(), l)
        l_hash = ' '.join(l_hash)
        return hashlib.sha256(l_hash.encode()).hexdigest()

    def hash(self):
        id_hash = self._hash_list(self.ids)
        images_hash = self._hash_list(self.images)
        caption_hash = self._hash_list(self.captions)
        return hashlib.sha256((id_hash+images_hash+caption_hash).encode()).hexdigest()

class FashionCLIP:
    """

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…