slidedeckai.helpers.icons_embeddings#


Generate and save the embeddings of a pre-defined list of icons. Compare them with keywords embeddings to find most relevant icons.

find_icons

Find relevant icon file names for a list of keywords.

get_embeddings

Generate embeddings for a list of texts using a pre-trained language model.

get_icons_list

Get a list of available icons.

load_saved_embeddings

Load precomputed embeddings and icons file names.

main

Example usage.

save_icons_embeddings

Generate and save the embeddings for the icon file names.

Generate and save the embeddings of a pre-defined list of icons. Compare them with keywords embeddings to find most relevant icons.

slidedeckai.helpers.icons_embeddings.find_icons(keywords: list[str]) list[str][source]#

Find relevant icon file names for a list of keywords.

Parameters:

keywords – The list of one or more keywords.

Returns:

A list of the file names relevant for each keyword.

slidedeckai.helpers.icons_embeddings.get_embeddings(texts: str | list[str]) ndarray[source]#

Generate embeddings for a list of texts using a pre-trained language model.

Parameters:

texts – A string or a list of strings to be converted into embeddings.

Returns:

A NumPy array containing the embeddings for the input texts.

Raises:

ValueError – If the input is not a string or a list of strings, or if any element in the list is not a string.

Example usage: >>> keyword = ‘neural network’ >>> file_names = [‘neural_network_icon.png’, ‘data_analysis_icon.png’, ‘machine_learning.png’] >>> keyword_embeddings = get_embeddings(keyword) >>> file_name_embeddings = get_embeddings(file_names)

slidedeckai.helpers.icons_embeddings.get_icons_list() list[str][source]#

Get a list of available icons.

Returns:

The icons file names.

slidedeckai.helpers.icons_embeddings.load_saved_embeddings() tuple[ndarray, ndarray][source]#

Load precomputed embeddings and icons file names.

Returns:

The embeddings and the icon file names.

slidedeckai.helpers.icons_embeddings.main()[source]#

Example usage.

slidedeckai.helpers.icons_embeddings.save_icons_embeddings()[source]#

Generate and save the embeddings for the icon file names.