ai-cfia / nachet-frontend

Frontend application for seed classification of images acquired from digital microscopes
MIT License
2 stars 2 forks source link

Implement Default Model Selection on Application Load #111

Closed CFIALeronB closed 3 weeks ago

CFIALeronB commented 1 month ago

Description

Upon application load, the Nachet Frontend fetches metadata for all available models from the Nachet Backend to populate a grid box style list for user selection. However, currently, the selectedModel state, which determines the model selected for seed image classification, does not automatically set to a default model as specified by the backend. This functionality is crucial for enhancing user experience by providing a pre-selected model ready for immediate use, especially for new users or in use cases where a default model is recommended for general purposes.

Expected Behavior

When the metadata is retrieved from the backend, and one of the objects includes a default attribute set to true, the selectedModel state should automatically update to this default model's endpoint name. This action should occur before any user interaction for model selection, ensuring that a default model is already selected upon the user accessing the model selection interface.

Current Behavior

The selectedModel state only updates upon user interaction when selecting a model from the grid box list. There is no current mechanism to automatically set a default model based on backend specifications.

Suggested Implementation

  1. Modify the fetchMetadata function to check for a default attribute within the fetched metadata objects.
  2. If an object with default: true is found, update the selectedModel state to the endpoint_name of this default model.
  3. Ensure that this check and update process happens as part of the metadata fetching and state initialization to ensure the default model is set right away.

Additional Context

The metadata object list from the backend looks like this:

[
  {
    "endpoint_name": "nachet-6seeds",
    "model_name": "Seed Classification",
    "created_by": "Amir Ardalan Kalantari Dehaghi",
    "creation_date": "2023-04-27",
    "version": "1",
    "description": "Trained using 6 seed images per image of 14of15 tagarno",
    "job_name": "neat_cartoon_k0y4m0vz",
    "dataset": "",
    "metrics": [],
    "identifiable": [],
    "default": true
  },
  {
    "endpoint_name": "nachet-6seeds",
    "model_name": "Model 2",
    "created_by": "Developer 2",
    "creation_date": "2023-06-14",
    "version": "1",
    "description": "Model 2 Description",
    "job_name": "neat_cartoon_k0y4m0vz",
    "dataset": "",
    "metrics": [],
    "identifiable": []
  }
]
rngadam commented 1 month ago

A user story might be useful to connect this to the corresponding matching issue that @MaxenceGui has to create.

MaxenceGui commented 1 month ago

To me, this is related to

I can modify the insertion module to add a default key to the pipeline in the pipeline_template.yaml.

Therefore, letting the data scientist decide which pipeline should be the default pipeline.