Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonalaird committed Feb 21, 2024
1 parent a689fb4 commit 5fd31f9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lmm_tools/data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def __init__(self, df: pd.DataFrame):
Args:
df (pd.DataFrame): The DataFrame containing "image_paths" and "image_id" columns.
"""
self.df = df
self.lmm: Optional[LMM] = None
Expand All @@ -46,7 +45,12 @@ def add_lmm(self, lmm: LMM) -> Self:
return self

def add_column(self, name: str, prompt: str) -> Self:
r"""Adds a new column to the DataFrame containing the generated metadata from the LMM."""
r"""Adds a new column to the DataFrame containing the generated metadata from the LMM.
Args:
name (str): The name of the column to be added.
prompt (str): The prompt to be used to generate the metadata.
"""
if self.lmm is None:
raise ValueError("LMM not set yet")

Expand All @@ -57,6 +61,7 @@ def add_column(self, name: str, prompt: str) -> Self:

def build_index(self, target_col: str) -> Self:
r"""This will generate embeddings for the `target_col` and build a searchable index over them, so next time you run search it will search over this index.
Args:
target_col (str): The column name containing the data to be indexed."""
if self.emb is None:
Expand All @@ -81,6 +86,7 @@ def get_embeddings(self) -> npt.NDArray[np.float32]:

def search(self, query: str, top_k: int = 10) -> List[Dict]:
r"""Searches the index for the most similar images to the query and returns the top_k results.
Args:
query (str): The query to search for.
top_k (int, optional): The number of results to return. Defaults to 10."""
Expand Down

0 comments on commit 5fd31f9

Please sign in to comment.