flip_api.file_services.download_file

Attributes

router

Functions

download_file(, user_id)

Download a 'model file' (file uploaded by a user to train/evaluate a model).

Module Contents

flip_api.file_services.download_file.router
flip_api.file_services.download_file.download_file(model_id: uuid.UUID, file_name: flip_api.domain.schemas.file.SafeFileName, db: sqlmodel.Session = Depends(get_session), user_id: uuid.UUID = Depends(verify_token)) fastapi.responses.StreamingResponse

Download a ‘model file’ (file uploaded by a user to train/evaluate a model).

Important: Do not confuse with the ‘retrieve_federated_results’ endpoint which is for downloading ‘model results’ generated as a result of a training/evaluation job and are stored in a different S3 bucket. While ‘viewer’ users can download ‘model results’ using the ‘retrieve_federated_results’ endpoint, only users with ‘modify’ access to a model can download ‘model files’ using this ‘download_file’ endpoint.

Parameters:
  • model_id (UUID) – The ID of the model to retrieve the file for.

  • file_name (str) – The name of the file to download.

  • db (Session) – Database session.

  • user_id (UUID) – User ID from authentication.

Returns:

A streaming response containing the file content.

Return type:

StreamingResponse

Raises:

HTTPException – If the user is not allowed, if the file does not exist, or there is an error during the download process.