Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions DashAI/back/api/api_v1/endpoints/explainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ async def get_global_explanation_plot(
Returns
-------
List[dict]
A JSON with the explanation plot.
A list of artifact dicts (``{"type", "payload", "title"}``) with the
explanation plots.

Raises
------
Expand All @@ -168,6 +169,8 @@ async def get_global_explanation_plot(
"""
import pickle

from DashAI.back.core.artifacts import normalize_artifacts

with session_factory() as db:
try:
global_explainer = db.scalars(
Expand Down Expand Up @@ -198,7 +201,7 @@ async def get_global_explanation_plot(
detail="Internal database error",
) from e

return plot
return normalize_artifacts(plot)


@router.post("/global", status_code=status.HTTP_201_CREATED)
Expand Down Expand Up @@ -441,7 +444,8 @@ async def get_local_explanation_plot(
Returns
-------
List[dict]
A JSON with the explanation plot.
A list of artifact dicts (``{"type", "payload", "title"}``) with the
explanation plots, typically one per explained instance.

Raises
------
Expand All @@ -451,6 +455,8 @@ async def get_local_explanation_plot(
"""
import pickle

from DashAI.back.core.artifacts import normalize_artifacts

with session_factory() as db:
try:
local_explainer = db.scalars(
Expand Down Expand Up @@ -481,7 +487,7 @@ async def get_local_explanation_plot(
detail="Internal database error",
) from e

return plots
return normalize_artifacts(plots)


@router.post("/local", status_code=status.HTTP_201_CREATED)
Expand Down
4 changes: 3 additions & 1 deletion DashAI/back/api/api_v1/endpoints/explorers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
ExplorerCreate,
ExplorerResultsOptions,
)
from DashAI.back.core.artifacts import normalize_artifacts
from DashAI.back.core.enums.status import ExplorerStatus
from DashAI.back.dependencies.database.models import Dataset, Explorer, Notebook

Expand Down Expand Up @@ -328,7 +329,8 @@ async def get_explorer_results(
detail="Error while getting explorer results",
) from e

return results
# Upgrade legacy {"data", "type", "config"} results from plugin explorers
return normalize_artifacts(results)


@router.put("/{explorer_id}/results/")
Expand Down
3 changes: 2 additions & 1 deletion DashAI/back/api/api_v1/endpoints/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
ValidateNodeParams,
ValidatePipelineParams,
)
from DashAI.back.core.artifacts import normalize_artifacts
from DashAI.back.dependencies.database.models import Dataset, Pipeline
from DashAI.back.pipeline.validator.nodes_definitions import NODES
from DashAI.back.pipeline.validator.pipeline_validator import PipelineValidator
Expand Down Expand Up @@ -280,7 +281,7 @@ async def get_pipeline_dataexploration_results(
)
results[exploration_id] = {
"exploration_type": exploration_type,
"results": result,
"results": normalize_artifacts(result),
"name": name,
}
except Exception as e:
Expand Down
Loading
Loading