-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preloading is working, working on notebook
- Loading branch information
Showing
1 changed file
with
55 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 29, | ||
"execution_count": 43, | ||
"id": "ffec7cb7-1a82-4148-aad1-bb3b1b19915b", | ||
"metadata": {}, | ||
"outputs": [], | ||
|
@@ -40,9 +40,7 @@ | |
" response = requests.get(url)\n", | ||
" \n", | ||
" if response.status_code == 200:\n", | ||
" with open(\"iris.csv\", \"wb\") as f:\n", | ||
" f.write(response.content)\n", | ||
" print(\"The Iris dataset has been downloaded and saved as iris.csv.\")\n", | ||
" return response.content\n", | ||
" else:\n", | ||
" print(\"Failed to download the dataset. Status code:\", response.status_code)\n", | ||
"\n", | ||
|
@@ -60,15 +58,15 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 30, | ||
"execution_count": 44, | ||
"id": "59fca5f8-a5d6-419d-835a-023a73c5a1d7", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"{'token': 'eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI2dUVlQ0xOc1hTQXZUN1VDek1FRVk2VmI4ajJnY1RhWlFESUpnbnFGSHVJIn0.eyJleHAiOjE3MTY1NzcwNTgsImlhdCI6MTcxNjU3Njc1OCwianRpIjoiZjBjYmZlYzYtZjJlMS00NDg0LTg0YWMtNzFjMGMwZWNmNTNlIiwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgwL2tleWNsb2FrL3JlYWxtcy9jbG93ZGVyIiwic3Vi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MJJ6zXeYzVj5RuUfhtZYJ3LfoknjuPBABI44dqo-Ixqh760m6HQKyZUfW62Lg-nGLYTvfoGtlResziGZ7u4L6vdsmmr_05SKGWdXxpVQUzwBNiXI2SO3FbWNk2uwR_qXL8WHyajHKCXvgHYHUbnAKJ1SRKO0xNfYDDlGKXuEn4fZfVmICq9693Z8emwydlcp8BVOaVuFqbsWwoRmEoSnK4bzLAH-CM-PFESPfbTrnu0Scnnw'}\n" | ||
] | ||
} | ||
], | ||
|
@@ -80,6 +78,9 @@ | |
"login_url = CLOWDER_URL + \"/api/v2/login\"\n", | ||
"response = requests.post(login_url, json = user_login_json)\n", | ||
"token = response.json()[\"token\"]\n", | ||
"headers = {\n", | ||
" 'Authorization': f'Bearer {token}'\n", | ||
"}\n", | ||
"print(response.json())" | ||
] | ||
}, | ||
|
@@ -93,15 +94,15 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 31, | ||
"execution_count": 45, | ||
"id": "91639e11-b553-4b57-a0df-6e91c661662f", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"{'name': 'Flower Dataset', 'description': 'Dataset for Flower Data', 'status': 'PRIVATE', 'id': '6650e202fcd9057e97ae2d8a', 'creator': {'email': '[email protected]', 'first_name': 'Vismayak', 'last_name': 'Mohanarajan', 'id': '663a45d5b75ca83d17ac6564', 'admin': True, 'admin_mode': True}, 'created': '2024-05-24T18:52:50.457552', 'modified': '2024-05-24T18:52:50.457556', 'user_views': 0, 'downloads': 0, 'thumbnail_id': None, 'standard_license': True, 'license_id': 'CC BY'}\n" | ||
"{'name': 'Flower Dataset', 'description': 'Dataset for Flower Data', 'status': 'PRIVATE', 'id': '66840cc55713c91cd9b89483', 'creator': {'email': '[email protected]', 'first_name': 'Vismayak', 'last_name': 'Mohanarajan', 'id': '663a45d5b75ca83d17ac6564', 'admin': True, 'admin_mode': True, 'read_only_user': False}, 'created': '2024-07-02T14:20:53.503934', 'modified': '2024-07-02T14:20:53.503942', 'user_views': 0, 'downloads': 0, 'thumbnail_id': None, 'standard_license': True, 'license_id': 'CC BY'}\n" | ||
] | ||
} | ||
], | ||
|
@@ -115,16 +116,57 @@ | |
" \"license_id\": \"CC BY\"\n", | ||
"}\n", | ||
"\n", | ||
"token = \"eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI2dUVlQ0xOc1hTQXZUN1VDek1FRVk2VmI4ajJnY1RhWlFESUpnbnFGSHVJIn0.eyJleHAiOjE3MTY1NzY5NjcsImlhdCI6MTcxNjU3NjY2NywiYXV0aF90aW1lIjoxNzE2NTc2Mzc1LCJqdGkiOiI5NzU3NTM1Mi04Y2FhLTRhMmUtODZhZC0wM2JkNDcwODhhZjkiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAva2V5Y2xvYWsvcmVhbG1zL2Nsb3dkZXIiLCJzdWIiOiJmODRjYmM2ZC1jMTNkLTQyZWYtYWE3Yy0xZDgyYWNjNWFlZWIiLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJjbG93ZGVyMi1iYWNrZW5kIiwic2Vzc2lvbl9zdGF0ZSI6IjdhMjJjZDFkLTQ3NDctNDAyNS1iNDk2LTUyYzNhOWUwZDhiYyIsImFsbG93ZWQtb3JpZ2lucyI6WyJodHRwOi8vbG9jYWxob3N0OjgwMDAiXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbImRlZmF1bHQtcm9sZXMtY2xvd2RlciIsIm9mZmxpbmVfYWNjZXNzIiwidW1hX2F1dGhvcml6YXRpb24iXX0sInNjb3BlIjoib3BlbmlkIHByb2ZpbGUgZW1haWwiLCJzaWQiOiI3YTIyY2QxZC00NzQ3LTQwMjUtYjQ5Ni01MmMzYTllMGQ4YmMiLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwibmFtZSI6IlZpc21heWFrIE1vaGFuYXJhamFuIiwicHJlZmVycmVkX3VzZXJuYW1lIjoibW9oYW5hcjJAaWxsaW5vaXMuZWR1IiwiZ2l2ZW5fbmFtZSI6IlZpc21heWFrIiwiZmFtaWx5X25hbWUiOiJNb2hhbmFyYWphbiIsImVtYWlsIjoibW9oYW5hcjJAaWxsaW5vaXMuZWR1In0.AHqeZ79L8OUW2zTYEaDeUmuhHAeDMcqlgR8CE7ScGBRt-4gj8QFipbkiiMt0LYbMNi97dv0O_-iojrMtnlaX1OubnEwI_mMcoGckpXc5CzCoAQ_Qri2ZnpfnClDa9wPu-G_aGL-Sv4UpAglSTCbpBxsE99EiBubMb0T3NpP8p0k_lJTSvAZPJdMJ2sPpBo4BPUUIZq9JBXAZF7YPL9ZzUOoQKJvpNlA_7fHBHDjdSKRbVjP5cCNldjHJ70D2j1HM4JJUwMirNWZ8SFaJiny5a7NoZ2fa_JQkA3ZRrwGPHxGh6JThhu_F-a-pv2CDSytPCSU5DJxnslNJ4ePLVKDWpQ\"\n", | ||
"headers = {\n", | ||
" 'Authorization': f'Bearer {token}'\n", | ||
"}\n", | ||
"\n", | ||
"\n", | ||
"dataset_url = CLOWDER_URL + \"/api/v2/datasets\"\n", | ||
"response = requests.post(dataset_url, json = dataset_json, headers = headers, params = dataset_params)\n", | ||
"dataset_id = response.json()['id']\n", | ||
"print(response.json())" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "51ad8ad2-bcb6-40d4-9587-44f6a1a7c09d", | ||
"metadata": {}, | ||
"source": [ | ||
"## Uploading File" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 47, | ||
"id": "ed02e036-edd0-403b-8292-9600946bc156", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"{'name': 'file', 'status': 'PRIVATE', 'id': '66840ced5713c91cd9b89485', 'creator': {'email': '[email protected]', 'first_name': 'Vismayak', 'last_name': 'Mohanarajan', 'id': '663a45d5b75ca83d17ac6564', 'admin': True, 'admin_mode': True, 'read_only_user': False}, 'created': '2024-07-02T14:21:33.733027', 'version_id': '2a4bbb53-8149-4384-9d55-2696c9d587ed', 'version_num': 1, 'dataset_id': '66840cc55713c91cd9b89483', 'folder_id': None, 'views': 0, 'downloads': 0, 'bytes': 4551, 'content_type': {'content_type': 'application/octet-stream', 'main_type': 'application'}, 'thumbnail_id': None, 'storage_type': 'minio', 'storage_path': None, 'object_type': 'file'}\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"\n", | ||
"file = download_iris_dataset()\n", | ||
"file_json = {\n", | ||
" \"file\": file,\n", | ||
" \"mediaType\": 'multipart/form-data'\n", | ||
"}\n", | ||
"save_file_url = CLOWDER_URL + \"/api/v2/datasets/\" + dataset_id + '/files'\n", | ||
"headers = {\n", | ||
" 'Authorization': f'Bearer {token}'\n", | ||
"}\n", | ||
"response = requests.post(save_file_url, files = file_json, headers = headers)\n", | ||
"print(response.json())" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "08c6673d-70d2-4879-948f-8db76eda4cde", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
|