(self, embedding_model, palettes)
Inits PaletteSearchIndex with a list of color palettes.

    The palette index will compute the nearest neighbors in the input palette
    list.

    Args:
      embedding_model: PaletteEmbeddingModel. The embedding model to use.
      palettes: A list of strings each representing a 5-color palette.
Inits PaletteSearchIndex with a list of color palettes.
Inits PaletteSearchIndex with a list of color palettes .
def __init__(self, embedding_model, palettes):
    """Inits PaletteSearchIndex with a list of color palettes.

    The palette index will compute the nearest neighbors in the input palette
    list.

    Args:
      embedding_model: PaletteEmbeddingModel. The embedding model to use.
      palettes: A list of strings each representing a 5-color palette.
    """
    self._embedding_model = embedding_model
    embeddings = self._embedding_model.BatchEmbed(palettes)
    self._index = annoy.AnnoyIndex(EMBEDDING_DIMENSION, metric='euclidean')
    for i, embedding in enumerate(embeddings):
      self._index.add_item(i, embedding)
    self._index.build(NUM_ANNOY_TREES)
def __init__ ( self , embedding_model , palettes ) : self . _embedding_model = embedding_model embeddings = self . _embedding_model . BatchEmbed ( palettes ) self . _index = annoy . AnnoyIndex ( EMBEDDING_DIMENSION , metric = 'euclidean' ) for i , embedding in enumerate ( embeddings ) : self . _index . add_item ( i , embedding ) self . _index . build ( NUM_ANNOY_TREES )