Skip to content

Commit

Permalink
add page about studio python api
Browse files Browse the repository at this point in the history
  • Loading branch information
aguschin committed Jul 12, 2023
1 parent 9d7f82b commit 0c7c289
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 7 deletions.
1 change: 1 addition & 0 deletions content/docs/sidebar.json
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@
}
]
},
"python-api",
"rest-api"
]
},
Expand Down
35 changes: 35 additions & 0 deletions content/docs/studio/python-api.md
Original file line number Diff line number Diff line change
@@ -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"
)
```
16 changes: 9 additions & 7 deletions content/docs/studio/rest-api.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# 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
[Studio access token](/doc/studio/user-guide/account-management#studio-access-token).

## 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.

Expand Down Expand Up @@ -49,7 +51,7 @@ actually download the model.
### Example curl
```
```sh
$ curl https://studio.iterative.ai/api/model-registry/[email protected]:iterative/demo-bank-customer-churn.git&name=randomforest-model&version=v2.0.0 --header "Authorization:token <TOKEN>"

{
Expand Down

0 comments on commit 0c7c289

Please sign in to comment.