blue-sandbox 5.294.1__py3-none-any.whl → 5.320.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. blue_sandbox/.abcli/alias.sh +2 -0
  2. blue_sandbox/.abcli/assets/publish.sh +30 -0
  3. blue_sandbox/.abcli/assets.sh +15 -0
  4. blue_sandbox/.abcli/tests/help.sh +0 -8
  5. blue_sandbox/README.py +6 -51
  6. blue_sandbox/__init__.py +1 -1
  7. blue_sandbox/assets/__main__.py +45 -0
  8. blue_sandbox/assets/functions.py +66 -0
  9. blue_sandbox/config.env +3 -1
  10. blue_sandbox/env.py +5 -0
  11. blue_sandbox/help/functions.py +0 -10
  12. {blue_sandbox-5.294.1.dist-info → blue_sandbox-5.320.1.dist-info}/METADATA +2 -10
  13. blue_sandbox-5.320.1.dist-info/RECORD +33 -0
  14. blue_sandbox/.abcli/cemetery/inference/cloudwatch.sh +0 -40
  15. blue_sandbox/.abcli/cemetery/inference/inference.sh +0 -155
  16. blue_sandbox/.abcli/microsoft_building_damage_assessment/ingest/list.sh +0 -21
  17. blue_sandbox/.abcli/microsoft_building_damage_assessment/ingest.sh +0 -76
  18. blue_sandbox/.abcli/microsoft_building_damage_assessment/install.sh +0 -50
  19. blue_sandbox/.abcli/microsoft_building_damage_assessment/label.sh +0 -26
  20. blue_sandbox/.abcli/microsoft_building_damage_assessment/tensorboard.sh +0 -21
  21. blue_sandbox/.abcli/microsoft_building_damage_assessment/train.sh +0 -53
  22. blue_sandbox/.abcli/microsoft_building_damage_assessment.sh +0 -15
  23. blue_sandbox/.abcli/sagesemseg/cache_dataset.sh +0 -49
  24. blue_sandbox/.abcli/sagesemseg/consts.sh +0 -3
  25. blue_sandbox/.abcli/sagesemseg/train.sh +0 -48
  26. blue_sandbox/.abcli/sagesemseg/upload_dataset.sh +0 -47
  27. blue_sandbox/.abcli/tests/microsoft_building_damage_assessment_ingest.sh +0 -13
  28. blue_sandbox/.abcli/tests/microsoft_building_damage_assessment_ingest_list.sh +0 -19
  29. blue_sandbox/.abcli/tests/microsoft_building_damage_assessment_label.sh +0 -12
  30. blue_sandbox/.abcli/tests/microsoft_building_damage_assessment_train.sh +0 -20
  31. blue_sandbox/.abcli/tests/sagesemseg_train.sh +0 -29
  32. blue_sandbox/list.py +0 -37
  33. blue_sandbox/microsoft_building_damage_assessment/README.py +0 -45
  34. blue_sandbox/microsoft_building_damage_assessment/__main__.py +0 -82
  35. blue_sandbox/microsoft_building_damage_assessment/ingest.py +0 -31
  36. blue_sandbox/microsoft_building_damage_assessment/label.py +0 -38
  37. blue_sandbox/microsoft_building_damage_assessment/sas_token.py +0 -9
  38. blue_sandbox/microsoft_building_damage_assessment/train.py +0 -95
  39. blue_sandbox-5.294.1.dist-info/RECORD +0 -54
  40. /blue_sandbox/{microsoft_building_damage_assessment → assets}/__init__.py +0 -0
  41. {blue_sandbox-5.294.1.dist-info → blue_sandbox-5.320.1.dist-info}/LICENSE +0 -0
  42. {blue_sandbox-5.294.1.dist-info → blue_sandbox-5.320.1.dist-info}/WHEEL +0 -0
  43. {blue_sandbox-5.294.1.dist-info → blue_sandbox-5.320.1.dist-info}/top_level.txt +0 -0
@@ -5,3 +5,5 @@ alias @damages=blue_sandbox_microsoft_building_damage_assessment
5
5
  alias sagesemseg=blue_sandbox_sagesemseg
6
6
 
7
7
  alias @sandbox=blue_sandbox
8
+
9
+ alias gpt=openai_commands_gpt
@@ -0,0 +1,30 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function abcli_assets_publish() {
4
+ local options=$1
5
+
6
+ local do_download=$(abcli_option_int "$options" download 0)
7
+ local do_push=$(abcli_option_int "$options" push 0)
8
+ local extensions=$(abcli_option "$options" extensions png+geojson)
9
+
10
+ local object_name=$(abcli_clarify_object $2 .)
11
+
12
+ [[ "$do_download" == 1 ]] &&
13
+ abcli_download - $object_name
14
+
15
+ abcli_eval dryrun=$do_dryrun \
16
+ python3 -m blue_sandbox.assets \
17
+ publish \
18
+ --object_name $object_name \
19
+ --extensions $extensions \
20
+ "${@:3}"
21
+ [[ $? -ne 0 ]] && return 1
22
+
23
+ [[ "$do_push" == 1 ]] &&
24
+ abcli_git \
25
+ assets \
26
+ push \
27
+ "$object_name update."
28
+
29
+ return 0
30
+ }
@@ -0,0 +1,15 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function abcli_assets() {
4
+ local task=$(abcli_unpack_keyword $1 help)
5
+
6
+ local function_name=abcli_assets_$task
7
+ if [[ $(type -t $function_name) == "function" ]]; then
8
+ $function_name "${@:2}"
9
+ return
10
+ fi
11
+
12
+ python3 -m blue_sandbox.assets "$@"
13
+ }
14
+
15
+ abcli_source_caller_suffix_path /assets
@@ -7,14 +7,6 @@ function test_blue_sandbox_help() {
7
7
  for module in \
8
8
  "@sandbox" \
9
9
  \
10
- "@damages" \
11
- "@damages ingest" \
12
- "@damages ingest list" \
13
- "@damages install" \
14
- "@damages label" \
15
- "@damages tensorboard" \
16
- "@damages train" \
17
- \
18
10
  "blue_sandbox"; do
19
11
  abcli_eval ,$options \
20
12
  abcli_help $module
blue_sandbox/README.py CHANGED
@@ -1,60 +1,15 @@
1
1
  import os
2
2
 
3
3
  from blue_objects import file, README
4
- from blue_options.help.functions import get_help
5
4
 
6
5
  from blue_sandbox import NAME, VERSION, ICON, REPO_NAME
7
- from blue_sandbox.microsoft_building_damage_assessment import (
8
- README as microsoft_building_damage_assessment_README,
9
- )
10
- from blue_sandbox.list import list_of_experiments
11
-
12
- items = [
13
- "{}[`{}`]({}) {} [![image]({})]({}) {}".format(
14
- experiment["ICON"],
15
- experiment_name,
16
- experiment["url"],
17
- experiment["status"],
18
- experiment["marquee"],
19
- experiment["url"],
20
- experiment["title"],
21
- )
22
- for experiment_name, experiment in list_of_experiments.items()
23
- if experiment_name != "template"
24
- ]
25
6
 
26
7
 
27
8
  def build():
28
- return all(
29
- README.build(
30
- items=thing.get("items", []),
31
- cols=thing.get("cols", 2),
32
- path=os.path.join(file.path(__file__), thing["path"]),
33
- help_function=thing.get("help_function", None),
34
- ICON=ICON,
35
- NAME=NAME,
36
- VERSION=VERSION,
37
- REPO_NAME=REPO_NAME,
38
- )
39
- for thing in (
40
- [
41
- {
42
- "items": items,
43
- "path": "..",
44
- },
45
- {
46
- "items": microsoft_building_damage_assessment_README.items,
47
- "cols": len(
48
- microsoft_building_damage_assessment_README.list_of_steps
49
- ),
50
- "path": "microsoft_building_damage_assessment",
51
- },
52
- {
53
- "path": "cemetery",
54
- },
55
- {
56
- "path": "sagesemseg",
57
- },
58
- ]
59
- )
9
+ return README.build(
10
+ path=os.path.join(file.path(__file__), ".."),
11
+ ICON=ICON,
12
+ NAME=NAME,
13
+ VERSION=VERSION,
14
+ REPO_NAME=REPO_NAME,
60
15
  )
blue_sandbox/__init__.py CHANGED
@@ -4,7 +4,7 @@ ICON = "🌀"
4
4
 
5
5
  DESCRIPTION = f"{ICON} A sandbox for ideas and experiments."
6
6
 
7
- VERSION = "5.294.1"
7
+ VERSION = "5.320.1"
8
8
 
9
9
  REPO_NAME = "blue-sandbox"
10
10
 
@@ -0,0 +1,45 @@
1
+ import argparse
2
+
3
+ from blueness import module
4
+ from blueness.argparse.generic import sys_exit
5
+
6
+ from blue_sandbox import NAME
7
+ from blue_sandbox.assets.functions import publish
8
+ from blue_sandbox.logger import logger
9
+
10
+ NAME = module.name(__file__, NAME)
11
+
12
+ parser = argparse.ArgumentParser(NAME)
13
+ parser.add_argument(
14
+ "task",
15
+ type=str,
16
+ help="publish",
17
+ )
18
+ parser.add_argument(
19
+ "--arg",
20
+ type=bool,
21
+ default=0,
22
+ help="0|1",
23
+ )
24
+ parser.add_argument(
25
+ "--object_name",
26
+ type=str,
27
+ )
28
+ parser.add_argument(
29
+ "--extensions",
30
+ type=str,
31
+ default="png+geojson",
32
+ help="png+geojson",
33
+ )
34
+ args = parser.parse_args()
35
+
36
+ success = False
37
+ if args.task == "publish":
38
+ success = publish(
39
+ object_name=args.object_name,
40
+ list_of_extensions=args.extensions.split("+"),
41
+ )
42
+ else:
43
+ success = None
44
+
45
+ sys_exit(logger, NAME, args.task, success)
@@ -0,0 +1,66 @@
1
+ import os
2
+ from typing import List
3
+ import glob
4
+ from tqdm import tqdm
5
+
6
+ from blueness import module
7
+ from blue_objects import objects, file
8
+ from blue_objects.env import abcli_path_git
9
+ from blue_geo.file.load import load_geodataframe
10
+ from blue_geo.file.save import save_geojson
11
+
12
+ from blue_sandbox import NAME
13
+ from blue_sandbox.logger import logger
14
+
15
+
16
+ NAME = module.name(__file__, NAME)
17
+
18
+
19
+ def publish(
20
+ object_name: str,
21
+ list_of_extensions: List[str],
22
+ log: bool = True,
23
+ ) -> bool:
24
+ logger.info(
25
+ "{}.publish {} / {}".format(
26
+ NAME,
27
+ object_name,
28
+ ", ".join(list_of_extensions),
29
+ )
30
+ )
31
+
32
+ for extension in tqdm(list_of_extensions):
33
+ for filename in glob.glob(
34
+ objects.path_of(
35
+ filename=f"*.{extension}",
36
+ object_name=object_name,
37
+ )
38
+ ):
39
+ published_filename = os.path.join(
40
+ abcli_path_git,
41
+ "assets",
42
+ object_name,
43
+ file.name_and_extension(filename),
44
+ )
45
+
46
+ if extension in ["png", "jpg", "jpeg", "gif"]:
47
+ if not file.copy(
48
+ filename,
49
+ published_filename,
50
+ log=log,
51
+ ):
52
+ return False
53
+
54
+ if extension == "geojson":
55
+ success, gdf = load_geodataframe(filename)
56
+ if not success:
57
+ return False
58
+
59
+ gdf = gdf.to_crs("EPSG:4326")
60
+
61
+ if not save_geojson(published_filename, gdf):
62
+ return False
63
+
64
+ logger.info(f"🔗 https://github.com/kamangir/assets/tree/main/{object_name}")
65
+
66
+ return True
blue_sandbox/config.env CHANGED
@@ -2,4 +2,6 @@ DAMAGES_TEST_DATASET_OBJECT_NAME=Maui-Hawaii-fires-Aug-23-ingest-2025-01-10-qqJq
2
2
 
3
3
  SAGESEMSEG_COMPLETED_JOB_pascal_voc_v1_debug_v2=sagesemseg-model-2025-01-11-22-00-08-bW-2025-01-12-06-00-08-928
4
4
 
5
- SAGESEMSEG_COMPLETED_JOB_pascal_voc_v1_full_v2=sagesemseg-model-2025-01-12-15-52-20-ly-2025-01-12-23-52-20-582
5
+ SAGESEMSEG_COMPLETED_JOB_pascal_voc_v1_full_v2=sagesemseg-model-2025-01-12-15-52-20-ly-2025-01-12-23-52-20-582
6
+
7
+ VISUALYZE_PORT=8080
blue_sandbox/env.py CHANGED
@@ -23,3 +23,8 @@ SAGESEMSEG_COMPLETED_JOB_pascal_voc_v1_full_v2 = os.getenv(
23
23
  )
24
24
 
25
25
  GROQ_API_KEY = os.getenv("GROQ_API_KEY", "")
26
+
27
+ VISUALYZE_PORT = os.getenv(
28
+ "VISUALYZE_PORT",
29
+ "",
30
+ )
@@ -2,15 +2,5 @@ from abcli.help.generic import help_functions as generic_help_functions
2
2
 
3
3
  from blue_sandbox import ALIAS
4
4
 
5
- from blue_sandbox.help.microsoft_building_damage_assessment import (
6
- help_functions as help_microsoft_building_damage_assessment,
7
- )
8
-
9
5
 
10
6
  help_functions = generic_help_functions(plugin_name=ALIAS)
11
-
12
- help_functions.update(
13
- {
14
- "microsoft_building_damage_assessment": help_microsoft_building_damage_assessment,
15
- }
16
- )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blue_sandbox
3
- Version: 5.294.1
3
+ Version: 5.320.1
4
4
  Summary: 🌀 A sandbox for ideas and experiments.
5
5
  Home-page: https://github.com/kamangir/blue-sandbox
6
6
  Author: Arash Abadpour (Kamangir)
@@ -32,10 +32,6 @@ Requires-Dist: pylint
32
32
  Requires-Dist: pytest
33
33
  Requires-Dist: python-dotenv[cli]
34
34
  Requires-Dist: tqdm
35
- Requires-Dist: azure-storage-blob
36
- Requires-Dist: fiona
37
- Requires-Dist: tensorboard
38
- Requires-Dist: sagemaker<3,>=2
39
35
  Dynamic: author
40
36
  Dynamic: author-email
41
37
  Dynamic: classifier
@@ -54,14 +50,10 @@ Dynamic: summary
54
50
  pip install blue-sandbox
55
51
  ```
56
52
 
57
- | | |
58
- | --- | --- |
59
- | 🧑🏽‍🚒[`palisades`](https://github.com/kamangir/palisades) 🎓 [![image](https://github.com/kamangir/assets/blob/main/palisades/predict-datacube-maxar_open_data-WildFires-LosAngeles-Jan-2025-11-031311102213-103001010B9A1B00-2025-01-20-x54yb0/640.gif?raw=true)](https://github.com/kamangir/palisades) Geospatial AI for Post-Disaster Damage Assessment using Maxar Open Data. | 🌀[`sagesemseg`](https://github.com/kamangir/blue-sandbox/blob/main/blue_sandbox/sagesemseg/README.md) ⏸️ [![image](https://github.com/kamangir/assets/blob/main/blue-sandbox/sagesemseg-predict.png?raw=true)](https://github.com/kamangir/blue-sandbox/blob/main/blue_sandbox/sagesemseg/README.md) A SemSeg (Semantic Segmenter) trained and deployed on AWS Sagemaker. |
60
- | 🌐[``@damages``](https://github.com/kamangir/blue-sandbox/blob/main/blue_sandbox/microsoft_building_damage_assessment/README.md) ⏸️ [![image](https://github.com/kamangir/assets/raw/main/blue-sandbox/Maui-Hawaii-fires-Aug-23-ingest-2025-01-10-qqJqhm.png?raw=true)](https://github.com/kamangir/blue-sandbox/blob/main/blue_sandbox/microsoft_building_damage_assessment/README.md) Satellite imagery damage assessment workflow | 🪦[`cemetery`](https://github.com/kamangir/blue-sandbox/blob/main/blue_sandbox/cemetery/README.md) 🪦 [![image](https://github.com/kamangir/assets/raw/main/blue-plugin/marquee.png?raw=true)](https://github.com/kamangir/blue-sandbox/blob/main/blue_sandbox/cemetery/README.md) An AI cemetery. |
61
53
 
62
54
  ---
63
55
 
64
56
 
65
57
  [![pylint](https://github.com/kamangir/blue-sandbox/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/blue-sandbox/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/blue-sandbox/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/blue-sandbox/actions/workflows/pytest.yml) [![bashtest](https://github.com/kamangir/blue-sandbox/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/blue-sandbox/actions/workflows/bashtest.yml) [![PyPI version](https://img.shields.io/pypi/v/blue-sandbox.svg)](https://pypi.org/project/blue-sandbox/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/blue-sandbox)](https://pypistats.org/packages/blue-sandbox)
66
58
 
67
- built by 🌀 [`blue_options-4.200.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_sandbox-5.294.1`](https://github.com/kamangir/blue-sandbox).
59
+ built by 🌀 [`blue_options-4.215.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_sandbox-5.320.1`](https://github.com/kamangir/blue-sandbox).
@@ -0,0 +1,33 @@
1
+ blue_sandbox/README.py,sha256=0-5yDVr9YjmE-PfwJUiwzm2vU_t6CPMg81lK-08Ti_8,298
2
+ blue_sandbox/__init__.py,sha256=S87nD46n4cC9z1bgE7Flp7NnvYBlRt5kPt9qhJnp4rc,323
3
+ blue_sandbox/__main__.py,sha256=aPRHSpGpk-bDbzhHpfLNsd3y1gGEHpnhoTF-RBweNwc,361
4
+ blue_sandbox/config.env,sha256=TMUch2y2XZcLEonfpb-VXFFCuFdyD_6TTgtOrBAqqs0,329
5
+ blue_sandbox/env.py,sha256=jXFVGqvLPXeapU6ziawXYfvtsT4ervHnUq2MhPtLsuU,626
6
+ blue_sandbox/functions.py,sha256=U41kQFNPpfYV6KJpMnkqgqLkozqXiG4tgV6rj8IW1BU,7
7
+ blue_sandbox/host.py,sha256=uJpiM105rnm6ySF16zA7waWekGBdec-dlpoRRU_QqwU,210
8
+ blue_sandbox/logger.py,sha256=ZoFrTIfJJGNtZUm2d7lkQjdB2SPl_KBKDmHJOcIivPM,107
9
+ blue_sandbox/sample.env,sha256=qtSmtvFB1SITG4XaG5dT45YWvGZgOW1_DJZf-WUTUXo,42
10
+ blue_sandbox/urls.py,sha256=tIZ36ONJEoUBM-tFhOpkVhLwb1OgLegUeEaBDqW4USM,24
11
+ blue_sandbox/.abcli/abcli.sh,sha256=xsJ4IzuQsvLZog6U8VTBFVXsEi6ADe13L8rn47XtlbU,196
12
+ blue_sandbox/.abcli/actions.sh,sha256=vImEUI105GRcxs2mAKGMqcvoErtmOPZZ-7dfSmUUxvE,230
13
+ blue_sandbox/.abcli/aka.sh,sha256=RHDU_JbEEL2B0vvvRJ3NVSsRSEjSu09jNY85n7DLe-k,21
14
+ blue_sandbox/.abcli/alias.sh,sha256=iO0wZPVClb6I_zRUJijXwtpVqJFIJSJ6E-sKlDEUsdE,189
15
+ blue_sandbox/.abcli/assets.sh,sha256=wSpbb2MWqBUcLBqSyOgtXUSZ9iertL3je8W_rXIwDO4,336
16
+ blue_sandbox/.abcli/blue_sandbox.sh,sha256=PGRJOgNGlC3XL5cw4ecZH40LDuc_6NVazTKhCWtZ-3g,233
17
+ blue_sandbox/.abcli/browse.sh,sha256=f8qa4qDVts2Am6_ldDwNeJXzhBQTk9PUKl0-a9wW1ww,287
18
+ blue_sandbox/.abcli/install.sh,sha256=zvl0GsHBmfw62ORmkMlhug264N_Zr8nc3rlPGFoq7Mk,125
19
+ blue_sandbox/.abcli/assets/publish.sh,sha256=Ef33Fr2on7a-stjVh1FNp1596faKZRdZfKcZkDNYzgg,749
20
+ blue_sandbox/.abcli/tests/README.sh,sha256=rmJM-BPnTcmpPbJ5GXsF8vd_a84JKryeKkZyVScUing,145
21
+ blue_sandbox/.abcli/tests/help.sh,sha256=Di6Bp4oL3le3qJ0EkL-jeBDU50GWwrcoHgEAZiT6is0,315
22
+ blue_sandbox/.abcli/tests/version.sh,sha256=jF8zoJN1eKE3LfDeRVG9uHEosmEVJX6RtKfdioyeN-o,150
23
+ blue_sandbox/assets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
+ blue_sandbox/assets/__main__.py,sha256=ktEHcucFJHH9-Ap_ZPiospA9a91vHP5TnTrHE9n40LU,867
25
+ blue_sandbox/assets/functions.py,sha256=Vr5U2jWusN9hBUL379so0y7nuZ-SQnvSn32Iz85kqM8,1716
26
+ blue_sandbox/help/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
27
+ blue_sandbox/help/__main__.py,sha256=3Cqp5oISrZCOUApmwoQoCj_0sQgtkiEkm_ob3LFKzRE,234
28
+ blue_sandbox/help/functions.py,sha256=6pqjFj4iQYWuRyhmEKe-ErPCZW963n-Q1AdfNbfeQos,165
29
+ blue_sandbox-5.320.1.dist-info/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
30
+ blue_sandbox-5.320.1.dist-info/METADATA,sha256=vgB_tCPRPCmoMxPDVN2OiV8FWa3zXE0ui1-OGpIKAdU,2162
31
+ blue_sandbox-5.320.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
32
+ blue_sandbox-5.320.1.dist-info/top_level.txt,sha256=4D9Cb9QUCaqdYAmBiCwvtlaYBtUYVVxv0Sxcr_pzgS8,13
33
+ blue_sandbox-5.320.1.dist-info/RECORD,,
@@ -1,40 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function cloudwatch() {
4
- blue_sandbox_cemetery_cloudwatch "$@"
5
- }
6
-
7
- function blue_sandbox_cemetery_cloudwatch() {
8
- local task=${1:=help}
9
-
10
- if [ "$task" == "help" ]; then
11
- local options="endpoint"
12
- abcli_show_usage "cloudwatch browse$EOP$ABCUL[$options]$ABCUL[<endpoint-name>]$EOPE" \
13
- "browse endpoint on cloudwatch." \
14
- "default endpoint: $(blue_sandbox_cemetery_inference_default_endpoint)"
15
- return
16
- fi
17
-
18
- local options=$2
19
-
20
- # https://docs.aws.amazon.com/sagemaker/latest/dg/logging-cloudwatch.html
21
- if [ "$task" == "browse" ]; then
22
- local object_type=$(abcli_option_choice "$options" endpoint endpoint)
23
-
24
- local url=""
25
- if [[ "$object_type" == endpoint ]]; then
26
- local endpoint_name=$(abcli_clarify_input $3 $(blue_sandbox_cemetery_inference_default_endpoint))
27
- abcli_log "🔗 endpoint: $endpoint_name"
28
- url="https://$ABCLI_AWS_REGION.console.aws.amazon.com/cloudwatch/home?region=$ABCLI_AWS_REGION#logEventViewer:group=/aws/sagemaker/Endpoints/$endpoint_name"
29
- else
30
- abcli_log_error "-cloudwatch: $task: $object_type: object type not found."
31
- return 1
32
- fi
33
-
34
- abcli_browse $url
35
- return
36
- fi
37
-
38
- abcli_log_error "blue_sandbox: cemetery: cloudwatch: $task: command not found."
39
- return 1
40
- }
@@ -1,155 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function blue_sandbox_cemetery_inference() {
4
- local task=$(abcli_unpack_keyword $1 help)
5
-
6
- if [ "$task" == "help" ]; then
7
- for task in create delete describe invoke list pull; do
8
- blue_sandbox_cemetery_inference "$task" "$@"
9
- done
10
- return
11
- fi
12
- local options=$2
13
-
14
- if [ $(abcli_option_int "$options" help 0) == 1 ]; then
15
- case $task in
16
- "create")
17
- local args="[--verbose 1]$ABCUL[--verify 0]"
18
- local options="dryrun,model"
19
- abcli_show_usage "@cemetery inference create$ABCUL[$options]$ABCUL[.|<object-name>]$ABCUL$args" \
20
- "create inference model."
21
-
22
- local options="dryrun,endpoint_config,suffix=<suffix>"
23
- abcli_show_usage "@cemetery inference create$ABCUL[$options]$ABCUL[.|<object-name>]$ABCUL$args" \
24
- "create inference endpoint config."
25
-
26
- local options="dryrun,endpoint,config_suffix=<suffix>,suffix=<suffix>"
27
- abcli_show_usage "@cemetery inference create$ABCUL[$options]$ABCUL[.|<object-name>]$ABCUL$args" \
28
- "create inference endpoint."
29
- ;;
30
- "delete")
31
- local args="[--verbose 1]"
32
- local options="dryrun,model|endpoint_config|endpoint"
33
- abcli_show_usage "@cemetery inference delete$ABCUL[$options]$ABCUL<name>$ABCUL$args" \
34
- "delete inference object."
35
- ;;
36
- "describe")
37
- local args="[--verbose 1]"
38
- local options="dryrun,endpoint"
39
- abcli_show_usage "@cemetery inference describe$ABCUL[$options]$ABCUL<name>$ABCUL$args" \
40
- "describe inference endpoint."
41
- ;;
42
- "invoke")
43
- local args="[--verbose 1]"
44
- local options="~download,dryrun,profile=$semseg_profiles,upload"
45
- abcli_show_usage "@cemetery inference invoke$EOP$ABCUL[$options]$ABCUL[-|<endpoint-name>]$ABCUL[..|<dataset-object-name>]$ABCUL[-|<prediction-object-name>]$ABCUL$args$EOPE" \
46
- "<dataset-object-name> -> inference endpoint -> <prediction-object-name>." \
47
- "default endpoint: $(blue_sandbox_cemetery_inference_default_endpoint)"
48
- ;;
49
- "list")
50
- local args="[--verbose 1]"
51
- local options="dryrun,model|endpoint_config|endpoint,contains=<string>"
52
- abcli_show_usage "@cemetery inference list$ABCUL[$options]$ABCUL$args" \
53
- "list inference objects."
54
- ;;
55
- "pull")
56
- local options="dryrun"
57
- abcli_show_usage "@cemetery inference pull$ABCUL[$options]" \
58
- "pull the inference image."
59
- ;;
60
- esac
61
- return
62
- fi
63
-
64
- if [[ ",create,delete,describe,list," == *",$task,"* ]]; then
65
- local object_type=$(abcli_option_choice "$options" model,endpoint_config,endpoint model)
66
- local do_dryrun=$(abcli_option_int "$options" dryrun 0)
67
- fi
68
-
69
- if [[ "$task" == "create" ]]; then
70
- local object_name=$(abcli_clarify_object $3 .)
71
-
72
- [[ "$object_type" == "model" ]] &&
73
- abcli_upload solid,~warn_if_exists $object_name
74
-
75
- abcli_eval dryrun=$do_dryrun \
76
- python3 -m blue_sandbox.cemetry.inference create \
77
- --suffix $(abcli_option "$options" suffix -) \
78
- --config_suffix $(abcli_option "$options" config_suffix -) \
79
- --object_type "$object_type" \
80
- --object_name "$object_name" \
81
- "${@:4}"
82
- return
83
- fi
84
-
85
- if [[ ",delete,describe," == *",$task,"* ]]; then
86
- abcli_eval dryrun=$do_dryrun \
87
- python3 -m blue_sandbox.cemetry.inference $task \
88
- --object_type "$object_type" \
89
- --object_name "$3" \
90
- "${@:4}"
91
- return
92
- fi
93
-
94
- if [[ "$task" == "invoke" ]]; then
95
- local do_dryrun=$(abcli_option_int "$options" dryrun 0)
96
- local do_download=$(abcli_option_int "$options" download $(abcli_not $do_dryrun))
97
- local do_upload=$(abcli_option_int "$options" upload $(abcli_not $do_dryrun))
98
-
99
- local endpoint_name=$(abcli_clarify_input $3 $(blue_sandbox_cemetery_inference_default_endpoint))
100
-
101
- local dataset_object_name=$(abcli_clarify_object $4 ..)
102
- [[ "$do_download" == 1 ]] &&
103
- abcli_download - $dataset_object_name
104
-
105
- local prediction_object_name=$(abcli_clarify_object $5 $(abcli_string_timestamp))
106
-
107
- abcli_log "endpoint[$endpoint_name].invoke($dataset_object_name) -> $prediction_object_name."
108
-
109
- abcli_eval dryrun=$do_dryrun \
110
- python3 -m blue_sandbox.cemetry.inference $task \
111
- --endpoint_name $endpoint_name \
112
- --dataset_path $ABCLI_OBJECT_ROOT/$dataset_object_name \
113
- --prediction_path $ABCLI_OBJECT_ROOT/$prediction_object_name \
114
- --profile $(abcli_option "$options" profile VALIDATION) \
115
- "${@:6}"
116
-
117
- [[ "$do_upload" == 1 ]] &&
118
- abcli_upload - $prediction_object_name
119
-
120
- return
121
- fi
122
-
123
- if [[ "$task" == "list" ]]; then
124
- abcli_eval dryrun=$do_dryrun \
125
- python3 -m blue_sandbox.cemetry.inference $task \
126
- --object_type "$object_type" \
127
- --object_name $(abcli_option "$options" contains -) \
128
- "${@:3}"
129
- return
130
- fi
131
-
132
- if [ "$task" == "pull" ]; then
133
- aws ecr get-login-password \
134
- --region $ABCLI_AWS_REGION |
135
- docker login \
136
- --username AWS \
137
- --password-stdin \
138
- 763104351884.dkr.ecr.$ABCLI_AWS_REGION.amazonaws.com
139
- [[ $? -ne 0 ]] && return 1
140
-
141
- local image_name=$(python3 -m blue_sandbox.cemetry.inference.image get --what name)
142
- abcli_log "🔗 image name: $image_name"
143
- abcli_eval dryrun=$do_dryrun \
144
- docker pull $image_name
145
-
146
- return
147
- fi
148
-
149
- abcli_log_error "@cemetery: inference: $task: command not found."
150
- return 1
151
- }
152
-
153
- function blue_sandbox_cemetery_inference_default_endpoint() {
154
- echo endpoint-$(abcli_cache read blue_sandbox_cemetery_semseg_model_AIRS_o2)-pytorch
155
- }
@@ -1,21 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function blue_sandbox_microsoft_building_damage_assessment_ingest_list() {
4
- local options=$1
5
- local event_name=$(abcli_option "$options" event all)
6
-
7
- local suffix=$2
8
-
9
- local url="s3://maxar-opendata/events/"
10
-
11
- [[ "$event_name" != all ]] &&
12
- url="$url$event_name/ard/"
13
-
14
- [[ ! -z "$suffix" ]] &&
15
- url="$url$suffix"
16
-
17
- abcli_eval ,$options \
18
- aws s3 ls --no-sign-request $url
19
-
20
- return 0
21
- }
@@ -1,76 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function blue_sandbox_microsoft_building_damage_assessment_ingest() {
4
- local options=$1
5
-
6
- local show_list=$(abcli_option_int "$options" list 0)
7
- if [[ "$show_list" == 1 ]]; then
8
- blue_sandbox_microsoft_building_damage_assessment_ingest_list "${@:2}"
9
- return
10
- fi
11
-
12
- local do_dryrun=$(abcli_option_int "$options" dryrun 0)
13
- local do_download=$(abcli_option_int "$options" download $(abcli_not $do_dryrun))
14
- local do_gdal=$(abcli_option_int "$options" gdal 1)
15
- local do_rm=$(abcli_option_int "$options" rm 1)
16
- local do_upload=$(abcli_option_int "$options" upload $(abcli_not $do_dryrun))
17
- local event_name=$(abcli_option "$options" event default)
18
-
19
- local object_name=$(abcli_clarify_object $2 $event_name-ingest-$(abcli_string_timestamp_short))
20
-
21
- abcli_log "ingesting $event_name -> $object_name ..."
22
-
23
- local object_path=$ABCLI_OBJECT_ROOT/$object_name
24
- mkdir -pv $object_path
25
-
26
- pushd $object_path >/dev/null
27
-
28
- # https://github.com/microsoft/building-damage-assessment/blob/main/SATELLITE_WORKFLOW.md#1-image-acquisition-and-label-generation
29
- mkdir -pv raw
30
- cd raw
31
-
32
- if [[ "$do_download" == 1 ]]; then
33
- # TODO: use $event_name and $count (options +=)
34
-
35
- abcli_eval ,$options \
36
- wget https://maxar-opendata.s3.amazonaws.com/events/Maui-Hawaii-fires-Aug-23/ard/04/122000330002/2023-08-12/10300100EB15FF00-visual.tif
37
- [[ $? -ne 0 ]] && return 1
38
-
39
- abcli_eval ,$options \
40
- wget https://maxar-opendata.s3.amazonaws.com/events/Maui-Hawaii-fires-Aug-23/ard/04/122000330020/2023-08-12/10300100EB15FF00-visual.tif
41
- [[ $? -ne 0 ]] && return 1
42
- fi
43
-
44
- if [[ "$do_gdal" == 1 ]]; then
45
- abcli_eval ,$options \
46
- gdalbuildvrt maxar_lahaina_8_12_2023-visual.vrt *.tif*
47
- [[ $? -ne 0 ]] && return 1
48
-
49
- abcli_eval ,$options \
50
- gdalwarp -co BIGTIFF=YES -co NUM_THREADS=ALL_CPUS -co COMPRESS=LZW -co PREDICTOR=2 -of COG maxar_lahaina_8_12_2023-visual.vrt maxar_lahaina_8_12_2023-visual.tif
51
- [[ $? -ne 0 ]] && return 1
52
- fi
53
-
54
- if [[ "$do_rm" == 1 ]]; then
55
- abcli_log "removing raw data ..."
56
- rm -v 10300100EB15FF00-visual.tif*
57
- rm -v maxar_lahaina_8_12_2023-visual.vrt
58
- fi
59
-
60
- popd >/dev/null
61
-
62
- abcli_eval dryrun=$do_dryrun \
63
- python3 -m blue_sandbox.microsoft_building_damage_assessment \
64
- ingest \
65
- --event_name $event_name \
66
- --object_name $object_name \
67
- "${@:3}"
68
- local status="$?"
69
-
70
- [[ "$do_upload" == 1 ]] &&
71
- abcli_upload - $object_name
72
-
73
- return $status
74
- }
75
-
76
- abcli_source_caller_suffix_path /ingest