Skip to content

docs: add quickstart update for deploy on spaces #5550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 40 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
7554f8c
feat: simplified minimal working example
davidberenstein1957 Sep 27, 2024
6c9d4c6
feat: add repo url to log message
davidberenstein1957 Sep 27, 2024
13eb667
fix: repr
davidberenstein1957 Sep 27, 2024
1cb094e
docs: update docstrings
davidberenstein1957 Sep 27, 2024
f77e193
feat: Add default org name set to argilla
davidberenstein1957 Sep 28, 2024
f1ae834
feat: Add better token user flow
davidberenstein1957 Sep 30, 2024
bacfe41
feat: add default fallback top username
davidberenstein1957 Sep 30, 2024
b7e489b
tests: Add unittests for the deployment
davidberenstein1957 Sep 30, 2024
4abf937
docs: add quickstart update for deploy on spaces
davidberenstein1957 Sep 30, 2024
66d1876
feat: set api key as required argument to be passed
davidberenstein1957 Sep 30, 2024
b73c893
tests: add api key to tests
davidberenstein1957 Sep 30, 2024
769e503
fix: only pass password to space secrets if it has been defined
davidberenstein1957 Sep 30, 2024
b00875d
fix: remove username and password and set those to hf_token ones
davidberenstein1957 Sep 30, 2024
9e8d14f
tests: fix removal of username and password
davidberenstein1957 Sep 30, 2024
3234103
Merge branch 'feat/5108-feature-add-method-to-deploy-on-spaces-throug…
davidberenstein1957 Sep 30, 2024
450db83
docs: add context on UI signin
davidberenstein1957 Sep 30, 2024
36983fc
docs: update indents
davidberenstein1957 Sep 30, 2024
308895d
docs: update code snippet
davidberenstein1957 Sep 30, 2024
c1a3a94
docs: add API reference
davidberenstein1957 Sep 30, 2024
3844a6d
chore: format docstring
davidberenstein1957 Sep 30, 2024
19e5c41
docs: explicit it is the website
davidberenstein1957 Sep 30, 2024
be1d3ad
docs: update quickstart docs UI/code
davidberenstein1957 Sep 30, 2024
4d416f1
docs: update flow for first time user
davidberenstein1957 Sep 30, 2024
4b2379c
docs: update flow first time users
davidberenstein1957 Sep 30, 2024
cd2b606
docs: add some phrasing
davidberenstein1957 Sep 30, 2024
05f89d5
feat: Add uuid to password generation
davidberenstein1957 Oct 2, 2024
9ab0319
feat: remove password generation and let that happen in Docker image
davidberenstein1957 Oct 7, 2024
cb9905d
refactor: move the __repr__ method to resource representation helper
davidberenstein1957 Oct 7, 2024
28e197a
processed comments code review
davidberenstein1957 Oct 11, 2024
f456d42
refactor: avoid duplicate token passing to hf api
davidberenstein1957 Oct 11, 2024
46dc98b
feat: add Literals for space hardware and storage
davidberenstein1957 Oct 11, 2024
e5e6e0b
Merge branch 'develop' into feat/5108-feature-add-method-to-deploy-on…
davidberenstein1957 Oct 11, 2024
0593d01
Apply suggestions from code review
davidberenstein1957 Oct 14, 2024
daf9592
docs: Update flow
davidberenstein1957 Oct 14, 2024
735f987
refactor: remove overwrite
davidberenstein1957 Oct 14, 2024
a600204
refactor: upadte warning message
davidberenstein1957 Oct 14, 2024
8533f83
feat: Add check for API KEY length
davidberenstein1957 Oct 14, 2024
af26c00
tests: Update test to facilitate new build and stopped logic
davidberenstein1957 Oct 14, 2024
01ac405
Merge branch 'feat/5108-feature-add-method-to-deploy-on-spaces-throug…
davidberenstein1957 Oct 17, 2024
2ed4039
Merge branch 'develop' into docs/deploy_on_spaces
davidberenstein1957 Oct 17, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This section details how to configure and deploy Argilla on Hugging Face Spaces.
- How to configure and disable HF OAuth access
- How to use Private Spaces

!!! tip "Looking to get started easily?"
!!! tip "Looking to get started easily or deploy Argilla with the Python SDK?"
If you just discovered Argilla and want to get started quickly, go to the [Quickstart guide](quickstart.md).

## Persistent storage
Expand Down Expand Up @@ -112,7 +112,6 @@ client = rg.Argilla(
)
```


## Space Secrets overview

Remember that, by default, Argilla Spaces are configured with a *Sign in with Hugging Face* button, which is also used to grant an `owner` to the creator of the Space. There are two optional secrets to set up the `USERNAME` and `PASSWORD` of the `owner` of Argilla Space. Those are useful when you want to create a different owner user to login into Argilla.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: Deploy Argilla with Docker
---

This guide describes how to deploy the Argilla Server with `docker compose`. This is useful if you want to deploy Argilla locally, and/or have full control over the configuration the server, database, and search engine (Elasticsearch).

First, you need to install `docker` on your machine and make sure you can run `docker compose`.
Expand Down
68 changes: 52 additions & 16 deletions argilla/docs/getting_started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,77 @@ Argilla is a free, open-source, self-hosted tool. This means you need to deploy

The **recommended choice to get started**. You can get up and running in under 5 minutes and don't need to maintain a server or run any commands.

If you're just getting started with Argilla, click the deploy button below:
=== "No-code"

<div style="margin: 5px">
<a href="http://huggingface.co/new-space?template=argilla/argilla-template-space&name=my-argilla" target="_blank">
<img src="https://huggingface.co/datasets/huggingface/badges/raw/main/deploy-to-spaces-lg.svg" />
</a>
</div>
You can use the default values following these steps:
If you're just getting started with Argilla, click the deploy button below:

- Leave the default Space owner (your personal account)
- Leave `USERNAME` and `PASSWORD` secrets empty since you'll sign in with your HF user as the Argilla Space `owner`.
- Click create Space to launch Argilla 🚀.
- Once you see the Argilla UI, [go to the Sign in into the Argilla UI section](#sign-in-into-the-argilla-ui). If you see the `Building` message for longer than 2-3 min refresh the page.
<div style="margin: 5px">
<a href="http://huggingface.co/new-space?template=argilla/argilla-template-space&name=my-argilla" target="_blank">
<img src="https://huggingface.co/datasets/huggingface/badges/raw/main/deploy-to-spaces-lg.svg" />
</a>
</div>

You can use the default values following these steps:

- Leave the default Space owner (your personal account)
- Leave `USERNAME` and `PASSWORD` secrets empty since you'll sign in with your HF user as the Argilla Space `owner`.
- Click create Space to launch Argilla 🚀.
- Once you see the Argilla UI, [go to the Sign in into the Argilla UI section](#sign-in-into-the-argilla-ui). If you see the `Building` message for longer than 2-3 min refresh the page.

=== "Python SDK"

If you want to deploy Argilla using the Python SDK, follow these steps:

First, install Argilla:

```console
pip install argilla
```

Next, we can use the `Argilla.deploy_on_spaces` method, which will create a Space in [the Hugging Face Hub](https://huggingface.co/). This method will automatically do the following:

- Deploy an Argilla Space on the Hugging Face Hub with [OAuth sign-in](#sign-in-into-the-argilla-ui) and a URL like `https://<your-username>-argilla.hf.space`, which takes around 2-3 minutes.
- Create a default workspace called `argilla` with an owner called `<your-username>` and an Argilla token set to `api_key`.
- Automatically return the authenticated Argilla client, which can directly be used to interact with your Argilla server.

```python
import argilla as rg

authenticated_client = rg.Argilla.deploy_on_spaces(api_key="<api_key>")
```

Learn how to [create your first dataset](create-your-first-dataset.md).


!!! tip "Argilla API Key"
Your Argilla API key can be found in the `My Settings` page of your Argilla Space. Take a look at the [sign in to the UI section](#sign-in-into-the-argilla-ui) to learn how to retrieve it.

!!! warning "Persistent storage `SMALL`"
Not setting persistent storage to `SMALL` means that **you will loose your data when the Space restarts**. Spaces get restarted due to maintainance, inactivity, and every time you change your Spaces settings. If you want to **use the Space just for testing** you can use `FREE` temporarily.

If you want to deploy Argilla within a Hugging Face organization, setup a more stable Space, or understand the settings, [check out the HF Spaces settings guide](how-to-configure-argilla-on-huggingface.md).

!!! docker "Deploy with Docker"
If you want to **run Argilla locally on your machine or a server**, or tune the server configuration, choose this option. To use this option, [check this guide](how-to-deploy-argilla-with-docker.md).

If you want to **run Argilla locally on your machine or a server**, or tune the server configuration, choose this option. To use this option, [check this guide](how-to-deploy-argilla-with-docker.md).

## Sign in into the Argilla UI

If everything went well, you should see the Argilla sign in page that looks like this:

![Focus view](../assets/images/getting_started/signin-hf-page.png){ width=100% height=100% }

!!! info "Building errors"
If you get a build error, sometimes restarting the Space from the Settings page works, otherwise [check the HF Spaces settings guide](how-to-configure-argilla-on-huggingface.md).


In the sign in page:

1. Click on **Sign in with Hugging Face**
1. Click on **Sign in with Hugging Face**.

2. **Authorize the application** and you will be logged in into Argilla as an `owner`.

!!! info "Unauthorized error"
Sometimes, after authorizing you'll see an unauthorized error, and get redirected to the sign in page. Typically, clicking the Sign in button solves the issue.
Sometimes, after authorizing you'll see an unauthorized error, and get redirected to the sign in page. Typically, clicking the Sign in button again will solve this issue.

Congrats! Your Argilla server is ready to start your first project using the Python SDK. You now have full rights to create datasets. Follow the instructions in the home page, or keep reading this guide if you want a more detailed explanation.

Expand All @@ -59,11 +93,12 @@ pip install argilla
```

## Create your first dataset

For getting started with Argilla and its SDK, we recommend to use Jupyter Notebook or Google Colab.

To start interacting with your Argilla server, you need to create a instantiate a client with an API key and API URL:

- The `<api_key>` is in the `My Settings` page of your Argilla Space.
- The `<api_key>` is in the `My Settings` page of your Argilla Space but make sure you are logged in with the `owner` account you used to create the Space.

- The `<api_url>` is the URL shown in your browser if it ends with `*.hf.space`.

Expand Down Expand Up @@ -133,6 +168,7 @@ dataset.records.log(records=data, mapping={"text": "review"})
🎉 You have successfully created your first dataset with Argilla. You can now access it in the Argilla UI and start annotating the records.

## Next steps

- To learn how to create your datasets, workspace, and manage users, check the [how-to guides](../how_to_guides/index.md).

- To learn Argilla with hands-on examples, check the [Tutorials section](../tutorials/index.md).
Expand Down
12 changes: 12 additions & 0 deletions argilla/docs/reference/argilla/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ To interact with the Argilla server from Python you can use the `Argilla` class.

## Usage Examples

### Deploying Argilla Server on Hugging Face Spaces

To deploy Argilla on Hugging Face Spaces, use the `deploy_on_spaces` method.

```python
import argilla as rg

client = rg.Argilla.deploy_on_spaces(api_key="12345678")
```

### Connecting to an Argilla server

To connect to an Argilla server, instantiate the `Argilla` class and pass the `api_url` of the server and the `api_key` to authenticate.
Expand Down Expand Up @@ -45,3 +55,5 @@ for dataset in my_workspace.datasets:
---

::: src.argilla.client.Argilla

::: src.argilla._helpers._deploy.SpacesDeploymentMixin
Loading