Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2409,7 +2409,6 @@ dataset = client.create_dataset(
name="object-detection", # Only lowercase alphanumeric characters + hyphen is available
tags=["cat", "dog"], # max 5 tags per dataset.
visibility="workspace", # visibility can be 'workspace' or 'public' or 'organization'
license="The MIT License" # Optional
)
```

Expand Down Expand Up @@ -2455,7 +2454,6 @@ You can filter by keywords and visibility, tags.
datasets = client.get_datasets(
keyword="dog",
tags=["cat", "dog"], # max 5 tags per dataset.
license="mit",
visibility="workspace", # visibility can be 'workspace' or 'public' or 'organization'.
)
```
Expand Down Expand Up @@ -2499,6 +2497,7 @@ dataset_object = client.create_dataset_object(
name="brushwood_dog.jpg",
file_path="./brushwood_dog.jpg",
tags=["dog"], # max 5 tags per dataset object.
licenses=["MIT", "my-license"], # max 10 licenses per dataset object
annotations=[
{
"keypoints": [
Expand Down Expand Up @@ -2633,13 +2632,14 @@ dataset_objects = client.get_dataset_objects(dataset="YOUR_DATASET_NAME")

The success response is the same as when created, but it is an array.

You can filter by version or revision_id and tags.
You can filter by version or revision_id, licenses and tags.

```python
dataset_objects = client.get_dataset_objects(
dataset="YOUR_DATASET_NAME",
version="latest", # default is "latest"
tags=["cat"],
licenses=["MIT"]
)
```

Expand Down Expand Up @@ -2672,6 +2672,7 @@ dataset_object = client.update_dataset_object(
dataset_id="YOUR_DATASET_ID",
object_name="brushwood_dog.jpg",
tags=["dog"], # max 5 tags per dataset object.
licenses=["MIT", "my-license"], # max 10 licenses per dataset object
annotations=[
{
"keypoints": [
Expand Down
2 changes: 1 addition & 1 deletion examples/create_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

client = fastlabel.Client()

dataset = client.create_dataset(name="object-detection", license="The MIT License")
dataset = client.create_dataset(name="object-detection")

pprint(dataset)
16 changes: 12 additions & 4 deletions fastlabel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3881,18 +3881,17 @@ def get_datasets(
return self.api.get_request(endpoint, params=params)

def create_dataset(
self, name: str, tags: List[str] = [], visibility: str = None, license: str = ""
self, name: str, tags: List[str] = [], visibility: str = None
) -> dict:
"""
Create a dataset.

name is name of your dataset. Only lowercase alphanumeric characters + hyphen is available (Required).
tags is a list of tag (Optional).
visibility are search terms in the dataset visibility.(Optional).
license is a license name of your dataset. (Optional)
"""
endpoint = "datasets-v2"
payload = {"name": name, "license": license}
payload = {"name": name}
if tags:
payload["tags"] = tags
if visibility:
Expand Down Expand Up @@ -3959,7 +3958,8 @@ def get_dataset_objects(
self,
dataset: str,
version: str = None,
tags: List[str] = None,
tags: Optional[List[str]] = None,
licenses: Optional[List[str]] = None,
revision_id: str = None,
offset: int = 0,
limit: int = 1000,
Expand Down Expand Up @@ -3991,6 +3991,8 @@ def get_dataset_objects(
tags = tags or []
if tags:
params["tags"] = tags
if licenses:
params["licenses"] = licenses
return self.api.get_request(endpoint, params=params)

def download_dataset_objects(
Expand Down Expand Up @@ -4088,6 +4090,7 @@ def create_dataset_object(
name: str,
file_path: str,
tags: List[str] = None,
licenses: List[str] = None,
annotations: List[dict] = None,
custom_metadata: Optional[Dict[str, str]] = None,
) -> dict:
Expand All @@ -4114,6 +4117,8 @@ def create_dataset_object(
}
if tags:
payload["tags"] = tags
if licenses:
payload["licenses"] = licenses
if annotations:
payload["annotations"] = annotations
if custom_metadata:
Expand All @@ -4125,13 +4130,16 @@ def update_dataset_object(
dataset_id: str,
object_name: str,
tags: Optional[List[str]] = None,
licenses: Optional[List[str]] = None,
annotations: Optional[List[dict]] = None,
custom_metadata: Optional[dict] = None,
) -> dict:
endpoint = "dataset-objects-v2"
payload = {"datasetId": dataset_id, "objectName": object_name}
if tags is not None:
payload["tags"] = tags
if licenses is not None:
payload["licenses"] = licenses
if annotations is not None:
payload["annotations"] = annotations
if custom_metadata is not None:
Expand Down