From 0c7c289ade5d2324b10b8a6f0bb0dfd6afe29d81 Mon Sep 17 00:00:00 2001 From: Alexander Guschin <1aguschin@gmail.com> Date: Wed, 12 Jul 2023 15:23:30 +0600 Subject: [PATCH] add page about studio python api --- content/docs/sidebar.json | 1 + content/docs/studio/python-api.md | 35 +++++++++++++++++++++++++++++++ content/docs/studio/rest-api.md | 16 +++++++------- 3 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 content/docs/studio/python-api.md diff --git a/content/docs/sidebar.json b/content/docs/sidebar.json index bfed7cd782..09b921f678 100644 --- a/content/docs/sidebar.json +++ b/content/docs/sidebar.json @@ -729,6 +729,7 @@ } ] }, + "python-api", "rest-api" ] }, diff --git a/content/docs/studio/python-api.md b/content/docs/studio/python-api.md new file mode 100644 index 0000000000..437e9ebc29 --- /dev/null +++ b/content/docs/studio/python-api.md @@ -0,0 +1,35 @@ +# Python API + +The purpose of Studio Python API is to give programmatic access to information +in Studio and executing actions in it. + +We provide Studio Python API as a part of DVC python package. To use it, you +need to [install](/doc/install) DVC with `pip` or `conda`. + +This reference provides the details about the functions in the `dvc.studio` +module, which can be loaded in any regular way, for example: + +```py +import dvc.studio +``` + +To use this API, you need to +[generate](/doc/studio/user-guide/account-management#studio-access-token) and +[set up](/doc/studio/user-guide/projects-and-experiments/live-metrics-and-plots#set-up-an-access-token) +Studio access token. + +## Download model + +Download model binaries for a model from Model Registry. Requires the model to +be stored with DVC with s3 or azure remote. Note, that you need to +[set up remote cloud credentials](/doc/studio/user-guide/account-management#cloud-credentials) +for Studio first. + +```py +from dvc.studio.model_registry import download_model +path = download_model( + repo="iterative/demo-bank-customer-churn", + model="randomforest-model", + version="v2.0.0" +) +``` diff --git a/content/docs/studio/rest-api.md b/content/docs/studio/rest-api.md index f6e6fdf316..b133266394 100644 --- a/content/docs/studio/rest-api.md +++ b/content/docs/studio/rest-api.md @@ -1,8 +1,10 @@ # REST API -Studio REST API is WIP and will be extended. The API is hosted under the `/api` -route on the Studio server: https://studio.iterative.ai/api or -https://your-domain/api in case of +The purpose of Studio REST API is to give programmatic access to information in +Studio and executing actions in it. + +The API is hosted under the `/api` route on the Studio server: +https://studio.iterative.ai/api or https://your-domain/api in case of [self-hosted Studio](/doc/studio/self-hosting/installation). To use API, you need to generate @@ -10,9 +12,9 @@ To use API, you need to generate ## Download model -Get signed url to download the model binary. Requires the model to be stored -with DVC with s3 or azure remote. `path` in model annotation must point to a -single file and not to a directory. Note, that you need to +Get signed url to download the model binaries for a model from Model Registry. +Requires the model to be stored with DVC with s3 or azure remote. Note, that you +need to [set up remote cloud credentials](/doc/studio/user-guide/account-management#cloud-credentials) for Studio have rights to sign urls. @@ -49,7 +51,7 @@ actually download the model. ### Example curl -``` +```sh $ curl https://studio.iterative.ai/api/model-registry/get-download-uris?repo=git@github.com:iterative/demo-bank-customer-churn.git&name=randomforest-model&version=v2.0.0 --header "Authorization:token " {