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
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2335,6 +2335,57 @@ Copy a project.
project_id = client.copy_project(project_id="YOUR_PROJECT_ID")
```

## Tags

### Get Tags

Get tags. (Up to 1000 tags)

keyword are search terms in the tag name (Optional).
offset is the starting position number to fetch (Optional).
limit is the max number to fetch (Optional).

If you need to fetch more than 1000 tags, please loop this method using offset and limit.
In the sample code below, you can fetch 1000 tags starting from the 2001st position.

```python
projects = client.get_tags(
project="YOUR_PROJECT_SLUG",
keyword="dog", # (Optional)
offset=2000, # (Optional)
limit=1000, # (Optional. Default is 100.)
)
```

### Response

Example of tags object

```python
[
{
"id": "YOUR_TAG_ID",
"name": "YOUR_TAG_NAME",
"order": 1,
"createdAt": "2023-08-14T11: 32: 36.462Z",
"updatedAt": "2023-08-14T11: 32: 36.462Z"
}
]
```

### Delete Tags

Delete tags.

```python
client.delete_tags(
tag_ids=[
"YOUR_TAG_ID_1",
"YOUR_TAG_ID_2",
],
)
```

## Dataset

### Create Dataset
Expand Down Expand Up @@ -2697,7 +2748,7 @@ Supported bbox annotation type.

Convert annotation file of YOLO format as a Fastlabel format and create task.

classes_file_path: YOLO classes text file path
classes_file_path: YOLO classes text file path
dataset_folder_path: Folder path containing YOLO Images and annotation

```python
Expand Down
40 changes: 39 additions & 1 deletion fastlabel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3772,6 +3772,45 @@ def copy_project(self, project_id: str) -> None:
endpoint = "projects/copy"
return self.api.post_request(endpoint, payload=payload)

# Tags

def get_tags(
self,
project: str,
keyword: str = None,
offset: int = None,
limit: int = 100,
) -> list:
"""
Returns a list of tags.
Returns up to 1000 at a time, to get more,
project is slug of your project (Required).
keyword are search terms in the tag name (Optional).
offset is the starting position number to fetch (Optional).
limit is the max number to fetch (Optional).
"""
if limit > 1000:
raise FastLabelInvalidException(
"Limit must be less than or equal to 1000.", 422
)
endpoint = "tags"
params = {"project": project}
if keyword:
params["keyword"] = keyword
if offset:
params["offset"] = offset
if limit:
params["limit"] = limit
return self.api.get_request(endpoint, params=params)

def delete_tags(self, tag_ids: List[str]) -> None:
"""
Delete a tags.
"""
endpoint = "tags/delete/multi"
payload = {"tagIds": tag_ids}
self.api.post_request(endpoint, payload=payload)

# Dataset

def find_dataset(self, dataset_id: str) -> dict:
Expand Down Expand Up @@ -4195,4 +4234,3 @@ def get_histories(
params["limit"] = limit

return self.api.get_request(endpoint, params=params)