Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
chore: add prompt viz, add new display for classifier and adjust layo…
Browse files Browse the repository at this point in the history
…ut for home
  • Loading branch information
d116626 committed Feb 7, 2024
1 parent 4fd520c commit 5d29ad0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/pages/Visualizar Prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@

data = get_prompts()
objects = pd.DataFrame(get_objects())
labels = get_objetcs_labels_df(objects)
labels = get_objetcs_labels_df(objects, keep_null=True)

prompt_parameters = data[0]
prompt_text = prompt_parameters.get("prompt_text")
prompt_objects = prompt_parameters.get("objects")


selected_labels_cols = ["name", "criteria", "identification_guide", "value"]
labels = labels[selected_labels_cols]
labels = labels[labels["name"].isin(prompt_objects)]
Expand Down
5 changes: 3 additions & 2 deletions app/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,12 @@ def explode_df(dataframe, column_to_explode, prefix=None):
return result_df


def get_objetcs_labels_df(objects):
def get_objetcs_labels_df(objects, keep_null=False):
objects_df = objects.rename(columns={"id": "object_id"})
objects_df = objects_df[["name", "object_id", "labels"]]
labels = explode_df(objects_df, "labels")
labels = labels[~labels["value"].isin(["null"])]
if not keep_null:
labels = labels[~labels["value"].isin(["null"])]
labels = labels.rename(columns={"label_id": "label"})
labels = labels.reset_index(drop=True)
return labels
Expand Down

0 comments on commit 5d29ad0

Please sign in to comment.