-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enhance RemoteDataset with comprehensive dataset management met…
…hods - Add detailed docstrings for RemoteDataset class and its methods - Improve logging with more informative messages - Implement `download_data()` method to retrieve dataset files - Refactor existing methods with better error handling and logging - Add context-specific logging for dataset operations
- Loading branch information
1 parent
1b07dec
commit f521336
Showing
2 changed files
with
213 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"vscode": { | ||
"languageId": "shellscript" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"!uv pip install -e ..[cpu]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Cloud Dataset" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import os\n", | ||
"from pprint import pprint\n", | ||
"\n", | ||
"from focoos import LOCAL_API_URL, Focoos\n", | ||
"\n", | ||
"focoos = Focoos(api_key=os.getenv(\"FOCOOS_API_KEY\"), host_url=LOCAL_API_URL)\n", | ||
"\n", | ||
"datasets = focoos.list_datasets(include_shared=False)\n", | ||
"pprint(datasets)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Delete datasets" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import os\n", | ||
"from pprint import pprint\n", | ||
"\n", | ||
"from focoos import LOCAL_API_URL, Focoos\n", | ||
"\n", | ||
"focoos = Focoos(api_key=os.getenv(\"FOCOOS_API_KEY\"), host_url=LOCAL_API_URL)\n", | ||
"\n", | ||
"datasets = focoos.list_datasets(include_shared=False)\n", | ||
"refs = [ds.ref for ds in datasets]\n", | ||
"for ref in refs:\n", | ||
" ds = focoos.get_remote_dataset(ref)\n", | ||
" ds.delete_data()\n", | ||
" ds.delete()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Upload Dataset" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from pprint import pprint\n", | ||
"\n", | ||
"from focoos import LOCAL_API_URL, DatasetLayout, Focoos, FocoosTask\n", | ||
"\n", | ||
"focoos = Focoos(host_url=LOCAL_API_URL)\n", | ||
"\n", | ||
"ds = focoos.add_remote_dataset(\n", | ||
" name=\"slot-car-3\", description=\"Slot Car Tracker\", layout=DatasetLayout.ROBOFLOW_COCO, task=FocoosTask.DETECTION\n", | ||
")\n", | ||
"ds_spec = ds.upload_data(\"./.data/carrera_go.zip\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Download Dataset" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import os\n", | ||
"\n", | ||
"from focoos import LOCAL_API_URL, Focoos\n", | ||
"\n", | ||
"focoos = Focoos(api_key=os.getenv(\"FOCOOS_API_KEY\"), host_url=LOCAL_API_URL)\n", | ||
"\n", | ||
"ds = focoos.get_remote_dataset(\"025410c1a752431c\")\n", | ||
"ds.download_data(\"./datasets\")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": ".venv", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.12.0" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |