alessandro trinca tornidor commited on
Commit
fcb8c81
β€’
1 Parent(s): 101b762

[refactor] rename samgis module tosamgis_lisa_on_cuda, bump to version 1.3.0, update samgis and lisa_on_cuda dependencies

Browse files
Files changed (49) hide show
  1. .coveragerc +1 -1
  2. .idea/.gitignore +0 -3
  3. .idea/misc.xml +7 -0
  4. Dockerfile +2 -2
  5. README.md +3 -37
  6. dockerfiles/dockerfile-fastapi-fastsam-api +0 -1
  7. dockerfiles/dockerfile-lambda-fastsam-api +0 -36
  8. dockerfiles/dockerfile-lisa-predictions +2 -2
  9. docs/modules.rst +3 -3
  10. docs/samgis.prediction_api.rst +0 -21
  11. docs/samgis.utilities.rst +0 -29
  12. docs/{samgis.io.rst β†’ samgis_lisa_on_cuda.io.rst} +18 -18
  13. docs/samgis_lisa_on_cuda.prediction_api.rst +37 -0
  14. docs/{samgis.rst β†’ samgis_lisa_on_cuda.rst} +6 -6
  15. docs/samgis_lisa_on_cuda.utilities.rst +37 -0
  16. poetry.lock +40 -110
  17. pyproject.toml +8 -4
  18. pytest.ini +1 -1
  19. samgis/__version__.py +0 -1
  20. {samgis β†’ samgis_lisa_on_cuda}/__init__.py +2 -2
  21. samgis_lisa_on_cuda/__version__.py +4 -0
  22. {samgis β†’ samgis_lisa_on_cuda}/io/__init__.py +0 -0
  23. {samgis β†’ samgis_lisa_on_cuda}/io/coordinates_pixel_conversion.py +4 -4
  24. {samgis β†’ samgis_lisa_on_cuda}/io/geo_helpers.py +1 -1
  25. {samgis β†’ samgis_lisa_on_cuda}/io/raster_helpers.py +3 -3
  26. {samgis β†’ samgis_lisa_on_cuda}/io/tms2geotiff.py +5 -5
  27. {samgis β†’ samgis_lisa_on_cuda}/io/wrappers_helpers.py +4 -4
  28. {samgis β†’ samgis_lisa_on_cuda}/prediction_api/__init__.py +0 -0
  29. {samgis β†’ samgis_lisa_on_cuda}/prediction_api/global_models.py +0 -0
  30. {samgis β†’ samgis_lisa_on_cuda}/prediction_api/lisa.py +5 -5
  31. {samgis β†’ samgis_lisa_on_cuda}/prediction_api/predictors.py +7 -7
  32. {samgis β†’ samgis_lisa_on_cuda}/utilities/__init__.py +0 -0
  33. {samgis β†’ samgis_lisa_on_cuda}/utilities/constants.py +0 -0
  34. {samgis β†’ samgis_lisa_on_cuda}/utilities/session_logger.py +0 -0
  35. {samgis β†’ samgis_lisa_on_cuda}/utilities/type_hints.py +0 -0
  36. scripts/extract-openapi-fastapi.py +1 -1
  37. scripts/extract-openapi-lambda.py +2 -2
  38. static/src/components/PageFooter.vue +1 -1
  39. tests/__init__.py +1 -1
  40. tests/io/test_coordinates_pixel_conversion.py +2 -2
  41. tests/io/test_geo_helpers.py +3 -3
  42. tests/io/test_raster_helpers.py +3 -3
  43. tests/io/test_tms2geotiff.py +2 -2
  44. tests/io/test_wrappers_helpers.py +5 -5
  45. tests/prediction_api/test_predictors.py +2 -2
  46. tests/test_fastapi_app.py +2 -2
  47. tests/test_lambda_app.py +2 -2
  48. wrappers/fastapi_wrapper.py +31 -15
  49. wrappers/lambda_wrapper.py +3 -3
.coveragerc CHANGED
@@ -1,5 +1,5 @@
1
  [run]
2
- source = samgis
3
  omit = ./venv/*,__version__.py,*tests*,*apps.py,*manage.py,*__init__.py,*migrations*,*asgi*,*wsgi*,*admin.py,*urls.py,./tests/*
4
 
5
  [report]
 
1
  [run]
2
+ source = samgis_lisa_on_cuda
3
  omit = ./venv/*,__version__.py,*tests*,*apps.py,*manage.py,*__init__.py,*migrations*,*asgi*,*wsgi*,*admin.py,*urls.py,./tests/*
4
 
5
  [report]
.idea/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- # Default ignored files
2
- /shelf/
3
- /workspace.xml
 
 
 
 
.idea/misc.xml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Black">
4
+ <option name="sdkName" value="Poetry (samgis-lisa-on-cuda)" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="Poetry (samgis-lisa-on-cuda)" project-jdk-type="Python SDK" />
7
+ </project>
Dockerfile CHANGED
@@ -152,7 +152,7 @@ ENV IS_AWS_LAMBDA=""
152
  # Set working directory to function root directory
153
  WORKDIR ${LAMBDA_TASK_ROOT}
154
 
155
- COPY samgis ${LAMBDA_TASK_ROOT}/samgis
156
  COPY wrappers ${LAMBDA_TASK_ROOT}/wrappers
157
 
158
  RUN ls -l /usr/bin/which
@@ -173,7 +173,7 @@ RUN python -c "import onnxruntime"
173
  RUN python -c "import rasterio"
174
  RUN python -c "import uvicorn"
175
  RUN df -h
176
- RUN ls -l ${LAMBDA_TASK_ROOT}/samgis/
177
  RUN ls -l ${LAMBDA_TASK_ROOT}/wrappers/
178
  RUN echo "LAMBDA_TASK_ROOT /static/:"
179
  RUN ls -l ${LAMBDA_TASK_ROOT}/static/ || true
 
152
  # Set working directory to function root directory
153
  WORKDIR ${LAMBDA_TASK_ROOT}
154
 
155
+ COPY samgis_lisa_on_cuda ${LAMBDA_TASK_ROOT}/samgis_lisa_on_cuda
156
  COPY wrappers ${LAMBDA_TASK_ROOT}/wrappers
157
 
158
  RUN ls -l /usr/bin/which
 
173
  RUN python -c "import rasterio"
174
  RUN python -c "import uvicorn"
175
  RUN df -h
176
+ RUN ls -l ${LAMBDA_TASK_ROOT}/samgis_lisa_on_cuda/
177
  RUN ls -l ${LAMBDA_TASK_ROOT}/wrappers/
178
  RUN echo "LAMBDA_TASK_ROOT /static/:"
179
  RUN ls -l ${LAMBDA_TASK_ROOT}/static/ || true
README.md CHANGED
@@ -14,7 +14,7 @@ from https://huggingface.co/aletrn/sam-quantized (copy them within the folder `/
14
 
15
  ## SamGIS - HuggingFace version
16
 
17
- The SamGIS HuggingSpace url is https://huggingface.co/spaces/aletrn/samgis.
18
  Build the docker image this way:
19
 
20
  ```bash
@@ -51,41 +51,7 @@ URL=http://localhost:7860/infer_samgis
51
  curl -d@./events/payload_point_eolie.json -H 'accept: application/json' ${URL}
52
  ```
53
 
54
- or better visiting the swagger page on http://localhost:7860/docs
55
-
56
-
57
- ## SamGIS - lambda AWS version
58
-
59
- Build the docker image this way:
60
-
61
- ```bash
62
- # clean any old active containers
63
- docker stop $(docker ps -a -q); docker rm $(docker ps -a -q)
64
-
65
- # build the base docker image with the docker aws repository tag
66
- docker build . -f dockerfiles/dockerfile-samgis-base --build-arg DEPENDENCY_GROUP=aws_lambda \
67
- --tag example-docker-namespace/samgis-base-aws-lambda --progress=plain
68
-
69
- # build the final docker image
70
- docker build . -f dockerfiles/dockerfile-lambda-fastsam-api --tag example-docker-namespace/lambda-fastsam-api --progress=plain
71
- ```
72
-
73
- Run the container (keep it on background) and show logs
74
-
75
- ```bash
76
- docker run -d --name lambda-fastsam-api -p 8080:8080 lambda-fastsam-api; docker logs -f lambda-fastsam-api
77
- ```
78
-
79
- Test it with curl using a json payload:
80
-
81
- ```bash
82
- URL=http://localhost:8080/2015-03-31/functions/function/invocations
83
- curl -d@./events/payload_point_eolie.json -H 'accept: application/json' ${URL}
84
- ```
85
-
86
- ### Publish the aws lambda docker image
87
- Login on aws ECR with the correct aws profile (change the example `example-docker-namespace/` repository url with the one from
88
- the [ECR push command instructions page](https://eu-west-1.console.aws.amazon.com/ecr/repositories/)).
89
 
90
  ### Dependencies installation and local tests
91
  The docker build process needs only the base dependency group plus the `aws_lambda` or `fastapi` optional one.
@@ -96,7 +62,7 @@ Install also the `test` and/or `docs` groups if needed.
96
  Tests are defined in the `tests` folder in this project. Use PIP to install the test dependencies and run tests.
97
 
98
  ```bash
99
- python -m pytest --cov=samgis --cov-report=term-missing && coverage html
100
  ```
101
 
102
  ### How to update the static documentation with sphinx
 
14
 
15
  ## SamGIS - HuggingFace version
16
 
17
+ The SamGIS HuggingSpace url is https://huggingface.co/spaces/aletrn/samgis-lisa-on-cuda.
18
  Build the docker image this way:
19
 
20
  ```bash
 
51
  curl -d@./events/payload_point_eolie.json -H 'accept: application/json' ${URL}
52
  ```
53
 
54
+ or better visiting the swagger page on http://localhost:7860/docs
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  ### Dependencies installation and local tests
57
  The docker build process needs only the base dependency group plus the `aws_lambda` or `fastapi` optional one.
 
62
  Tests are defined in the `tests` folder in this project. Use PIP to install the test dependencies and run tests.
63
 
64
  ```bash
65
+ python -m pytest --cov=samgis_lisa_on_cuda --cov-report=term-missing && coverage html
66
  ```
67
 
68
  ### How to update the static documentation with sphinx
dockerfiles/dockerfile-fastapi-fastsam-api DELETED
@@ -1 +0,0 @@
1
- Dockerfile
 
 
dockerfiles/dockerfile-lambda-fastsam-api DELETED
@@ -1,36 +0,0 @@
1
- FROM localhost/samgis-base-aws-lambda:latest
2
-
3
- # Include global arg in this stage of the build
4
- ARG LAMBDA_TASK_ROOT="/var/task"
5
- ARG PYTHONPATH="${LAMBDA_TASK_ROOT}:${PYTHONPATH}:/usr/local/lib/python3/dist-packages"
6
- ENV VIRTUAL_ENV=${LAMBDA_TASK_ROOT}/.venv \
7
- PATH="${LAMBDA_TASK_ROOT}/.venv/bin:$PATH"
8
- ENV IS_AWS_LAMBDA="True"
9
-
10
- # Set working directory to function root directory
11
- WORKDIR ${LAMBDA_TASK_ROOT}
12
- COPY ./samgis ${LAMBDA_TASK_ROOT}/samgis
13
- COPY ./wrappers ${LAMBDA_TASK_ROOT}/wrappers
14
-
15
- RUN ls -l /usr/bin/which
16
- RUN /usr/bin/which python
17
- RUN python -v
18
- RUN echo "PYTHONPATH: ${PYTHONPATH}."
19
- RUN echo "PATH: ${PATH}."
20
- RUN echo "LAMBDA_TASK_ROOT: ${LAMBDA_TASK_ROOT}."
21
- RUN ls -l ${LAMBDA_TASK_ROOT}
22
- RUN ls -ld ${LAMBDA_TASK_ROOT}
23
- RUN ls -l ${LAMBDA_TASK_ROOT}/machine_learning_models
24
- RUN python -c "import sys; print(sys.path)"
25
- RUN python -c "import awslambdaric"
26
- RUN python -c "import cv2"
27
- RUN python -c "import geopandas"
28
- RUN python -c "import onnxruntime"
29
- RUN python -c "import rasterio"
30
- RUN df -h
31
- RUN ls -l /lambda-entrypoint.sh
32
- RUN ls -l ${LAMBDA_TASK_ROOT}/samgis/
33
- RUN ls -l ${LAMBDA_TASK_ROOT}/wrappers/
34
-
35
- ENTRYPOINT ["/lambda-entrypoint.sh"]
36
- CMD [ "wrappers.lambda_wrapper.lambda_handler" ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dockerfiles/dockerfile-lisa-predictions CHANGED
@@ -10,7 +10,7 @@ ENV IS_AWS_LAMBDA=""
10
  # Set working directory to function root directory
11
  WORKDIR ${LAMBDA_TASK_ROOT}
12
 
13
- COPY samgis ${LAMBDA_TASK_ROOT}/samgis
14
  COPY wrappers ${LAMBDA_TASK_ROOT}/wrappers
15
 
16
  RUN ls -l /usr/bin/which
@@ -31,7 +31,7 @@ RUN python -c "import onnxruntime"
31
  RUN python -c "import rasterio"
32
  RUN python -c "import uvicorn"
33
  RUN df -h
34
- RUN ls -l ${LAMBDA_TASK_ROOT}/samgis/
35
  RUN ls -l ${LAMBDA_TASK_ROOT}/wrappers/
36
  RUN ls -l ${FASTAPI_STATIC}/
37
  RUN ls -l ${FASTAPI_STATIC}/dist
 
10
  # Set working directory to function root directory
11
  WORKDIR ${LAMBDA_TASK_ROOT}
12
 
13
+ COPY samgis_lisa_on_cuda ${LAMBDA_TASK_ROOT}/samgis_lisa_on_cuda
14
  COPY wrappers ${LAMBDA_TASK_ROOT}/wrappers
15
 
16
  RUN ls -l /usr/bin/which
 
31
  RUN python -c "import rasterio"
32
  RUN python -c "import uvicorn"
33
  RUN df -h
34
+ RUN ls -l ${LAMBDA_TASK_ROOT}/samgis_lisa_on_cuda/
35
  RUN ls -l ${LAMBDA_TASK_ROOT}/wrappers/
36
  RUN ls -l ${FASTAPI_STATIC}/
37
  RUN ls -l ${FASTAPI_STATIC}/dist
docs/modules.rst CHANGED
@@ -1,7 +1,7 @@
1
- samgis
2
- ======
3
 
4
  .. toctree::
5
  :maxdepth: 4
6
 
7
- samgis
 
1
+ samgis_lisa_on_cuda
2
+ ===================
3
 
4
  .. toctree::
5
  :maxdepth: 4
6
 
7
+ samgis_lisa_on_cuda
docs/samgis.prediction_api.rst DELETED
@@ -1,21 +0,0 @@
1
- samgis.prediction\_api package
2
- ==============================
3
-
4
- Submodules
5
- ----------
6
-
7
- samgis.prediction\_api.predictors module
8
- ----------------------------------------
9
-
10
- .. automodule:: samgis.prediction_api.predictors
11
- :members:
12
- :undoc-members:
13
- :show-inheritance:
14
-
15
- Module contents
16
- ---------------
17
-
18
- .. automodule:: samgis.prediction_api
19
- :members:
20
- :undoc-members:
21
- :show-inheritance:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/samgis.utilities.rst DELETED
@@ -1,29 +0,0 @@
1
- samgis.utilities package
2
- ========================
3
-
4
- Submodules
5
- ----------
6
-
7
- samgis.utilities.constants module
8
- ---------------------------------
9
-
10
- .. automodule:: samgis.utilities.constants
11
- :members:
12
- :undoc-members:
13
- :show-inheritance:
14
-
15
- samgis.utilities.type\_hints module
16
- -----------------------------------
17
-
18
- .. automodule:: samgis.utilities.type_hints
19
- :members:
20
- :undoc-members:
21
- :show-inheritance:
22
-
23
- Module contents
24
- ---------------
25
-
26
- .. automodule:: samgis.utilities
27
- :members:
28
- :undoc-members:
29
- :show-inheritance:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/{samgis.io.rst β†’ samgis_lisa_on_cuda.io.rst} RENAMED
@@ -1,45 +1,45 @@
1
- samgis.io package
2
- =================
3
 
4
  Submodules
5
  ----------
6
 
7
- samgis.io.coordinates\_pixel\_conversion module
8
- -----------------------------------------------
9
 
10
- .. automodule:: samgis.io.coordinates_pixel_conversion
11
  :members:
12
  :undoc-members:
13
  :show-inheritance:
14
 
15
- samgis.io.geo\_helpers module
16
- -----------------------------
17
 
18
- .. automodule:: samgis.io.geo_helpers
19
  :members:
20
  :undoc-members:
21
  :show-inheritance:
22
 
23
- samgis.io.raster\_helpers module
24
- --------------------------------
25
 
26
- .. automodule:: samgis.io.raster_helpers
27
  :members:
28
  :undoc-members:
29
  :show-inheritance:
30
 
31
- samgis.io.tms2geotiff module
32
- ----------------------------
33
 
34
- .. automodule:: samgis.io.tms2geotiff
35
  :members:
36
  :undoc-members:
37
  :show-inheritance:
38
 
39
- samgis.io.wrappers\_helpers module
40
- ----------------------------------
41
 
42
- .. automodule:: samgis.io.wrappers_helpers
43
  :members:
44
  :undoc-members:
45
  :show-inheritance:
@@ -47,7 +47,7 @@ samgis.io.wrappers\_helpers module
47
  Module contents
48
  ---------------
49
 
50
- .. automodule:: samgis.io
51
  :members:
52
  :undoc-members:
53
  :show-inheritance:
 
1
+ samgis\_lisa\_on\_cuda.io package
2
+ =================================
3
 
4
  Submodules
5
  ----------
6
 
7
+ samgis\_lisa\_on\_cuda.io.coordinates\_pixel\_conversion module
8
+ ---------------------------------------------------------------
9
 
10
+ .. automodule:: samgis_lisa_on_cuda.io.coordinates_pixel_conversion
11
  :members:
12
  :undoc-members:
13
  :show-inheritance:
14
 
15
+ samgis\_lisa\_on\_cuda.io.geo\_helpers module
16
+ ---------------------------------------------
17
 
18
+ .. automodule:: samgis_lisa_on_cuda.io.geo_helpers
19
  :members:
20
  :undoc-members:
21
  :show-inheritance:
22
 
23
+ samgis\_lisa\_on\_cuda.io.raster\_helpers module
24
+ ------------------------------------------------
25
 
26
+ .. automodule:: samgis_lisa_on_cuda.io.raster_helpers
27
  :members:
28
  :undoc-members:
29
  :show-inheritance:
30
 
31
+ samgis\_lisa\_on\_cuda.io.tms2geotiff module
32
+ --------------------------------------------
33
 
34
+ .. automodule:: samgis_lisa_on_cuda.io.tms2geotiff
35
  :members:
36
  :undoc-members:
37
  :show-inheritance:
38
 
39
+ samgis\_lisa\_on\_cuda.io.wrappers\_helpers module
40
+ --------------------------------------------------
41
 
42
+ .. automodule:: samgis_lisa_on_cuda.io.wrappers_helpers
43
  :members:
44
  :undoc-members:
45
  :show-inheritance:
 
47
  Module contents
48
  ---------------
49
 
50
+ .. automodule:: samgis_lisa_on_cuda.io
51
  :members:
52
  :undoc-members:
53
  :show-inheritance:
docs/samgis_lisa_on_cuda.prediction_api.rst ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ samgis\_lisa\_on\_cuda.prediction\_api package
2
+ ==============================================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ samgis\_lisa\_on\_cuda.prediction\_api.global\_models module
8
+ ------------------------------------------------------------
9
+
10
+ .. automodule:: samgis_lisa_on_cuda.prediction_api.global_models
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+ samgis\_lisa\_on\_cuda.prediction\_api.lisa module
16
+ --------------------------------------------------
17
+
18
+ .. automodule:: samgis_lisa_on_cuda.prediction_api.lisa
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+ samgis\_lisa\_on\_cuda.prediction\_api.predictors module
24
+ --------------------------------------------------------
25
+
26
+ .. automodule:: samgis_lisa_on_cuda.prediction_api.predictors
27
+ :members:
28
+ :undoc-members:
29
+ :show-inheritance:
30
+
31
+ Module contents
32
+ ---------------
33
+
34
+ .. automodule:: samgis_lisa_on_cuda.prediction_api
35
+ :members:
36
+ :undoc-members:
37
+ :show-inheritance:
docs/{samgis.rst β†’ samgis_lisa_on_cuda.rst} RENAMED
@@ -1,5 +1,5 @@
1
- samgis package
2
- ==============
3
 
4
  Subpackages
5
  -----------
@@ -7,14 +7,14 @@ Subpackages
7
  .. toctree::
8
  :maxdepth: 4
9
 
10
- samgis.io
11
- samgis.prediction_api
12
- samgis.utilities
13
 
14
  Module contents
15
  ---------------
16
 
17
- .. automodule:: samgis
18
  :members:
19
  :undoc-members:
20
  :show-inheritance:
 
1
+ samgis\_lisa\_on\_cuda package
2
+ ==============================
3
 
4
  Subpackages
5
  -----------
 
7
  .. toctree::
8
  :maxdepth: 4
9
 
10
+ samgis_lisa_on_cuda.io
11
+ samgis_lisa_on_cuda.prediction_api
12
+ samgis_lisa_on_cuda.utilities
13
 
14
  Module contents
15
  ---------------
16
 
17
+ .. automodule:: samgis_lisa_on_cuda
18
  :members:
19
  :undoc-members:
20
  :show-inheritance:
docs/samgis_lisa_on_cuda.utilities.rst ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ samgis\_lisa\_on\_cuda.utilities package
2
+ ========================================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ samgis\_lisa\_on\_cuda.utilities.constants module
8
+ -------------------------------------------------
9
+
10
+ .. automodule:: samgis_lisa_on_cuda.utilities.constants
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+ samgis\_lisa\_on\_cuda.utilities.session\_logger module
16
+ -------------------------------------------------------
17
+
18
+ .. automodule:: samgis_lisa_on_cuda.utilities.session_logger
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+ samgis\_lisa\_on\_cuda.utilities.type\_hints module
24
+ ---------------------------------------------------
25
+
26
+ .. automodule:: samgis_lisa_on_cuda.utilities.type_hints
27
+ :members:
28
+ :undoc-members:
29
+ :show-inheritance:
30
+
31
+ Module contents
32
+ ---------------
33
+
34
+ .. automodule:: samgis_lisa_on_cuda.utilities
35
+ :members:
36
+ :undoc-members:
37
+ :show-inheritance:
poetry.lock CHANGED
@@ -1410,42 +1410,38 @@ files = [
1410
 
1411
  [[package]]
1412
  name = "lisa-on-cuda"
1413
- version = "0.1.0"
1414
  description = ""
1415
  optional = false
1416
- python-versions = "^3.10"
1417
- files = []
1418
- develop = false
 
 
1419
 
1420
  [package.dependencies]
1421
- bitsandbytes = "^0.42.0"
1422
- einops = "^0.7.0"
1423
- fastapi = "^0.110.0"
1424
- gradio = "^4.21.0"
1425
- gradio-client = "^0.12.0"
1426
- markdown2 = "^2.4.13"
1427
- nh3 = "^0.2.15"
1428
  numpy = "1.25.2"
1429
- openai = "^1.13.3"
1430
  opencv-python-headless = "4.8.1.78"
1431
- packaging = "^24.0"
1432
- peft = "^0.9.0"
1433
- pycocotools = "^2.0.7"
1434
- ray = "^2.9.3"
1435
- scipy = "^1.11.4"
1436
- sentencepiece = "^0.2.0"
1437
- shortuuid = "^1.0.12"
1438
- torch = "^2.2.1"
1439
- torchvision = "^0.17.1"
1440
- tqdm = "^4.66.2"
1441
  transformers = "4.31.0"
1442
- uvicorn = "^0.28.0"
1443
-
1444
- [package.source]
1445
- type = "git"
1446
- url = "https://huggingface.co/spaces/aletrn/lisa-on-cuda"
1447
- reference = "packaging"
1448
- resolved_reference = "910b2411812e8ecc9e336909dec4b5a698f3506c"
1449
 
1450
  [[package]]
1451
  name = "loguru"
@@ -2089,9 +2085,8 @@ files = [
2089
 
2090
  [package.dependencies]
2091
  numpy = [
2092
- {version = ">=1.23.5", markers = "python_version >= \"3.11\""},
2093
- {version = ">=1.21.4", markers = "python_version >= \"3.10\" and platform_system == \"Darwin\" and python_version < \"3.11\""},
2094
- {version = ">=1.21.2", markers = "platform_system != \"Darwin\" and python_version >= \"3.10\" and python_version < \"3.11\""},
2095
  ]
2096
 
2097
  [[package]]
@@ -2164,64 +2159,6 @@ files = [
2164
  {file = "packaging-24.0.tar.gz", hash = "sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9"},
2165
  ]
2166
 
2167
- [[package]]
2168
- name = "pandas"
2169
- version = "2.1.0"
2170
- description = "Powerful data structures for data analysis, time series, and statistics"
2171
- optional = false
2172
- python-versions = ">=3.9"
2173
- files = [
2174
- {file = "pandas-2.1.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:40dd20439ff94f1b2ed55b393ecee9cb6f3b08104c2c40b0cb7186a2f0046242"},
2175
- {file = "pandas-2.1.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d4f38e4fedeba580285eaac7ede4f686c6701a9e618d8a857b138a126d067f2f"},
2176
- {file = "pandas-2.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6e6a0fe052cf27ceb29be9429428b4918f3740e37ff185658f40d8702f0b3e09"},
2177
- {file = "pandas-2.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9d81e1813191070440d4c7a413cb673052b3b4a984ffd86b8dd468c45742d3cc"},
2178
- {file = "pandas-2.1.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:eb20252720b1cc1b7d0b2879ffc7e0542dd568f24d7c4b2347cb035206936421"},
2179
- {file = "pandas-2.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:38f74ef7ebc0ffb43b3d633e23d74882bce7e27bfa09607f3c5d3e03ffd9a4a5"},
2180
- {file = "pandas-2.1.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cda72cc8c4761c8f1d97b169661f23a86b16fdb240bdc341173aee17e4d6cedd"},
2181
- {file = "pandas-2.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d97daeac0db8c993420b10da4f5f5b39b01fc9ca689a17844e07c0a35ac96b4b"},
2182
- {file = "pandas-2.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d8c58b1113892e0c8078f006a167cc210a92bdae23322bb4614f2f0b7a4b510f"},
2183
- {file = "pandas-2.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:629124923bcf798965b054a540f9ccdfd60f71361255c81fa1ecd94a904b9dd3"},
2184
- {file = "pandas-2.1.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:70cf866af3ab346a10debba8ea78077cf3a8cd14bd5e4bed3d41555a3280041c"},
2185
- {file = "pandas-2.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:d53c8c1001f6a192ff1de1efe03b31a423d0eee2e9e855e69d004308e046e694"},
2186
- {file = "pandas-2.1.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:86f100b3876b8c6d1a2c66207288ead435dc71041ee4aea789e55ef0e06408cb"},
2187
- {file = "pandas-2.1.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:28f330845ad21c11db51e02d8d69acc9035edfd1116926ff7245c7215db57957"},
2188
- {file = "pandas-2.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b9a6ccf0963db88f9b12df6720e55f337447aea217f426a22d71f4213a3099a6"},
2189
- {file = "pandas-2.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d99e678180bc59b0c9443314297bddce4ad35727a1a2656dbe585fd78710b3b9"},
2190
- {file = "pandas-2.1.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:b31da36d376d50a1a492efb18097b9101bdbd8b3fbb3f49006e02d4495d4c644"},
2191
- {file = "pandas-2.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:0164b85937707ec7f70b34a6c3a578dbf0f50787f910f21ca3b26a7fd3363437"},
2192
- {file = "pandas-2.1.0.tar.gz", hash = "sha256:62c24c7fc59e42b775ce0679cfa7b14a5f9bfb7643cfbe708c960699e05fb918"},
2193
- ]
2194
-
2195
- [package.dependencies]
2196
- numpy = {version = ">=1.23.2", markers = "python_version >= \"3.11\""}
2197
- python-dateutil = ">=2.8.2"
2198
- pytz = ">=2020.1"
2199
- tzdata = ">=2022.1"
2200
-
2201
- [package.extras]
2202
- all = ["PyQt5 (>=5.15.6)", "SQLAlchemy (>=1.4.36)", "beautifulsoup4 (>=4.11.1)", "bottleneck (>=1.3.4)", "dataframe-api-compat (>=0.1.7)", "fastparquet (>=0.8.1)", "fsspec (>=2022.05.0)", "gcsfs (>=2022.05.0)", "html5lib (>=1.1)", "hypothesis (>=6.46.1)", "jinja2 (>=3.1.2)", "lxml (>=4.8.0)", "matplotlib (>=3.6.1)", "numba (>=0.55.2)", "numexpr (>=2.8.0)", "odfpy (>=1.4.1)", "openpyxl (>=3.0.10)", "pandas-gbq (>=0.17.5)", "psycopg2 (>=2.9.3)", "pyarrow (>=7.0.0)", "pymysql (>=1.0.2)", "pyreadstat (>=1.1.5)", "pytest (>=7.3.2)", "pytest-asyncio (>=0.17.0)", "pytest-xdist (>=2.2.0)", "pyxlsb (>=1.0.9)", "qtpy (>=2.2.0)", "s3fs (>=2022.05.0)", "scipy (>=1.8.1)", "tables (>=3.7.0)", "tabulate (>=0.8.10)", "xarray (>=2022.03.0)", "xlrd (>=2.0.1)", "xlsxwriter (>=3.0.3)", "zstandard (>=0.17.0)"]
2203
- aws = ["s3fs (>=2022.05.0)"]
2204
- clipboard = ["PyQt5 (>=5.15.6)", "qtpy (>=2.2.0)"]
2205
- compression = ["zstandard (>=0.17.0)"]
2206
- computation = ["scipy (>=1.8.1)", "xarray (>=2022.03.0)"]
2207
- consortium-standard = ["dataframe-api-compat (>=0.1.7)"]
2208
- excel = ["odfpy (>=1.4.1)", "openpyxl (>=3.0.10)", "pyxlsb (>=1.0.9)", "xlrd (>=2.0.1)", "xlsxwriter (>=3.0.3)"]
2209
- feather = ["pyarrow (>=7.0.0)"]
2210
- fss = ["fsspec (>=2022.05.0)"]
2211
- gcp = ["gcsfs (>=2022.05.0)", "pandas-gbq (>=0.17.5)"]
2212
- hdf5 = ["tables (>=3.7.0)"]
2213
- html = ["beautifulsoup4 (>=4.11.1)", "html5lib (>=1.1)", "lxml (>=4.8.0)"]
2214
- mysql = ["SQLAlchemy (>=1.4.36)", "pymysql (>=1.0.2)"]
2215
- output-formatting = ["jinja2 (>=3.1.2)", "tabulate (>=0.8.10)"]
2216
- parquet = ["pyarrow (>=7.0.0)"]
2217
- performance = ["bottleneck (>=1.3.4)", "numba (>=0.55.2)", "numexpr (>=2.8.0)"]
2218
- plot = ["matplotlib (>=3.6.1)"]
2219
- postgresql = ["SQLAlchemy (>=1.4.36)", "psycopg2 (>=2.9.3)"]
2220
- spss = ["pyreadstat (>=1.1.5)"]
2221
- sql-other = ["SQLAlchemy (>=1.4.36)"]
2222
- test = ["hypothesis (>=6.46.1)", "pytest (>=7.3.2)", "pytest-asyncio (>=0.17.0)", "pytest-xdist (>=2.2.0)"]
2223
- xml = ["lxml (>=4.8.0)"]
2224
-
2225
  [[package]]
2226
  name = "pandas"
2227
  version = "2.2.1"
@@ -2261,10 +2198,7 @@ files = [
2261
  ]
2262
 
2263
  [package.dependencies]
2264
- numpy = [
2265
- {version = ">=1.23.2,<2", markers = "python_version == \"3.11\""},
2266
- {version = ">=1.22.4,<2", markers = "python_version < \"3.11\""},
2267
- ]
2268
  python-dateutil = ">=2.8.2"
2269
  pytz = ">=2020.1"
2270
  tzdata = ">=2022.7"
@@ -3395,27 +3329,23 @@ testing = ["h5py (>=3.7.0)", "huggingface_hub (>=0.12.1)", "hypothesis (>=6.70.2
3395
  torch = ["safetensors[numpy]", "torch (>=1.10)"]
3396
 
3397
  [[package]]
3398
- name = "samgis-core"
3399
- version = "1.0.5"
3400
  description = "SamGIS CORE"
3401
  optional = false
3402
- python-versions = "^3.10"
3403
- files = []
3404
- develop = false
 
 
3405
 
3406
  [package.dependencies]
3407
- bson = "^0.5.10"
3408
- loguru = "^0.7.2"
3409
  numpy = "1.25.2"
3410
  onnxruntime = "1.16.3"
3411
  opencv-python-headless = "4.8.1.78"
3412
- pillow = "^10.2.0"
3413
-
3414
- [package.source]
3415
- type = "git"
3416
- url = "https://gitlab.com/aletrn/samgis_core.git"
3417
- reference = "dev"
3418
- resolved_reference = "30a473a54476ea973564f6bdd9453f291b3928b6"
3419
 
3420
  [[package]]
3421
  name = "scipy"
@@ -4452,5 +4382,5 @@ files = [
4452
 
4453
  [metadata]
4454
  lock-version = "2.0"
4455
- python-versions = "^3.10"
4456
- content-hash = "b53d09cabb776f3009ca99021624310b3da5cc8172b64de8cc694cd32dd7451c"
 
1410
 
1411
  [[package]]
1412
  name = "lisa-on-cuda"
1413
+ version = "1.0.2"
1414
  description = ""
1415
  optional = false
1416
+ python-versions = ">=3.10,<3.11"
1417
+ files = [
1418
+ {file = "lisa_on_cuda-1.0.2-py3-none-any.whl", hash = "sha256:fd0bab06cd673b52b6a68c0b9add8dfed2ab57737b94a6fe375cb71c1ec923e0"},
1419
+ {file = "lisa_on_cuda-1.0.2.tar.gz", hash = "sha256:96b446405b27b6c001bb5e5db15489b6ba4c60b67323ab7874cc54bc9d6da56e"},
1420
+ ]
1421
 
1422
  [package.dependencies]
1423
+ bitsandbytes = ">=0.42.0,<0.43.0"
1424
+ einops = ">=0.7.0,<0.8.0"
1425
+ fastapi = ">=0.110.0,<0.111.0"
1426
+ gradio = ">=4.21.0,<5.0.0"
1427
+ gradio-client = ">=0.12.0,<0.13.0"
1428
+ markdown2 = ">=2.4.13,<3.0.0"
1429
+ nh3 = ">=0.2.15,<0.3.0"
1430
  numpy = "1.25.2"
1431
+ openai = ">=1.13.3,<2.0.0"
1432
  opencv-python-headless = "4.8.1.78"
1433
+ packaging = ">=24.0,<25.0"
1434
+ peft = ">=0.9.0,<0.10.0"
1435
+ pycocotools = ">=2.0.7,<3.0.0"
1436
+ ray = ">=2.9.3,<3.0.0"
1437
+ scipy = ">=1.11.4,<2.0.0"
1438
+ sentencepiece = ">=0.2.0,<0.3.0"
1439
+ shortuuid = ">=1.0.12,<2.0.0"
1440
+ torch = ">=2.2.1,<3.0.0"
1441
+ torchvision = ">=0.17.1,<0.18.0"
1442
+ tqdm = ">=4.66.2,<5.0.0"
1443
  transformers = "4.31.0"
1444
+ uvicorn = ">=0.28.0,<0.29.0"
 
 
 
 
 
 
1445
 
1446
  [[package]]
1447
  name = "loguru"
 
2085
 
2086
  [package.dependencies]
2087
  numpy = [
2088
+ {version = ">=1.21.4", markers = "python_version >= \"3.10\" and platform_system == \"Darwin\""},
2089
+ {version = ">=1.21.2", markers = "platform_system != \"Darwin\" and python_version >= \"3.10\""},
 
2090
  ]
2091
 
2092
  [[package]]
 
2159
  {file = "packaging-24.0.tar.gz", hash = "sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9"},
2160
  ]
2161
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2162
  [[package]]
2163
  name = "pandas"
2164
  version = "2.2.1"
 
2198
  ]
2199
 
2200
  [package.dependencies]
2201
+ numpy = {version = ">=1.22.4,<2", markers = "python_version < \"3.11\""}
 
 
 
2202
  python-dateutil = ">=2.8.2"
2203
  pytz = ">=2020.1"
2204
  tzdata = ">=2022.7"
 
3329
  torch = ["safetensors[numpy]", "torch (>=1.10)"]
3330
 
3331
  [[package]]
3332
+ name = "samgis_core"
3333
+ version = "1.0.7"
3334
  description = "SamGIS CORE"
3335
  optional = false
3336
+ python-versions = ">=3.10,<3.11"
3337
+ files = [
3338
+ {file = "samgis_core-1.0.7-py3-none-any.whl", hash = "sha256:3f586fa1f9f42f4f52d0ab196fe927be2df03ead8fc59d0441a973adb5fa0933"},
3339
+ {file = "samgis_core-1.0.7.tar.gz", hash = "sha256:c87df720f1e79eda66d1150dc15af5f52a5080aa427f887e89367ee615d7f681"},
3340
+ ]
3341
 
3342
  [package.dependencies]
3343
+ bson = ">=0.5.10,<0.6.0"
3344
+ loguru = ">=0.7.2,<0.8.0"
3345
  numpy = "1.25.2"
3346
  onnxruntime = "1.16.3"
3347
  opencv-python-headless = "4.8.1.78"
3348
+ pillow = ">=10.2.0,<11.0.0"
 
 
 
 
 
 
3349
 
3350
  [[package]]
3351
  name = "scipy"
 
4382
 
4383
  [metadata]
4384
  lock-version = "2.0"
4385
+ python-versions = "~3.10"
4386
+ content-hash = "6420e74251249e5a97a0c7faa9f6bf02311ca0b7f7e1c466bb6283efd97da03d"
pyproject.toml CHANGED
@@ -1,11 +1,15 @@
1
  [tool.poetry]
2
  name = "samgis-lisa-on-cuda"
3
- version = "1.2.3"
4
  description = "A VLM backend for machine learning instance segmentation on geospatial data that uses LISA (Reasoning Segmentation via Large Language Model)."
5
  authors = ["alessandro trinca tornidor <alessandro@trinca.tornidor.com>"]
6
  license = "MIT license"
7
  readme = "README.md"
8
 
 
 
 
 
9
  [tool.poetry.dependencies]
10
  bson = "^0.5.10"
11
  contextily = "^1.5.2"
@@ -15,12 +19,12 @@ numpy = "1.25.2"
15
  onnxruntime = "1.16.3"
16
  opencv-python-headless = "^4.8.1.78"
17
  pillow = "^10.2.0"
18
- python = "^3.10"
19
  python-dotenv = "^1.0.1"
20
  rasterio = "^1.3.9"
21
  requests = "^2.31.0"
22
- samgis-core = { git = "https://gitlab.com/aletrn/samgis_core.git", rev = "dev" }
23
- lisa-on-cuda = { git = "https://huggingface.co/spaces/aletrn/lisa-on-cuda", rev = "packaging" }
24
 
25
  [tool.poetry.group.aws_lambda]
26
  optional = true
 
1
  [tool.poetry]
2
  name = "samgis-lisa-on-cuda"
3
+ version = "1.3.0"
4
  description = "A VLM backend for machine learning instance segmentation on geospatial data that uses LISA (Reasoning Segmentation via Large Language Model)."
5
  authors = ["alessandro trinca tornidor <alessandro@trinca.tornidor.com>"]
6
  license = "MIT license"
7
  readme = "README.md"
8
 
9
+ [metadata]
10
+ name = "samgis-lisa-on-cuda"
11
+ version = "1.3.0"
12
+
13
  [tool.poetry.dependencies]
14
  bson = "^0.5.10"
15
  contextily = "^1.5.2"
 
19
  onnxruntime = "1.16.3"
20
  opencv-python-headless = "^4.8.1.78"
21
  pillow = "^10.2.0"
22
+ python = "~3.10"
23
  python-dotenv = "^1.0.1"
24
  rasterio = "^1.3.9"
25
  requests = "^2.31.0"
26
+ lisa-on-cuda = "^1.0.2"
27
+ samgis-core = "^1.0.7"
28
 
29
  [tool.poetry.group.aws_lambda]
30
  optional = true
pytest.ini CHANGED
@@ -3,5 +3,5 @@ env_override_existing_values = 1
3
  env_files =
4
  test/.test.env
5
  [path]
6
- source = samgis
7
  omit = ./venv/*,*tests*,*apps.py,*manage.py,*__init__.py,*migrations*,*asgi*,*wsgi*,*admin.py,*urls.py,./tests/*
 
3
  env_files =
4
  test/.test.env
5
  [path]
6
+ source = samgis_lisa_on_cuda
7
  omit = ./venv/*,*tests*,*apps.py,*manage.py,*__init__.py,*migrations*,*asgi*,*wsgi*,*admin.py,*urls.py,./tests/*
samgis/__version__.py DELETED
@@ -1 +0,0 @@
1
- __version__ = "1.2.3"
 
 
{samgis β†’ samgis_lisa_on_cuda}/__init__.py RENAMED
@@ -1,10 +1,10 @@
1
  """Get machine learning predictions from geodata raster images"""
2
  import os
3
 
4
- # not used here but contextily_tile is imported in samgis.io.tms2geotiff
5
  from contextily import tile as contextily_tile
6
  from pathlib import Path
7
- from samgis.utilities.constants import SERVICE_NAME
8
 
9
  ROOT = Path(globals().get("__file__", "./_")).absolute().parent.parent
10
  PROJECT_ROOT_FOLDER = Path(os.getenv("PROJECT_ROOT_FOLDER", ROOT))
 
1
  """Get machine learning predictions from geodata raster images"""
2
  import os
3
 
4
+ # not used here but contextily_tile is imported in samgis_lisa_on_cuda.io.tms2geotiff
5
  from contextily import tile as contextily_tile
6
  from pathlib import Path
7
+ from samgis_lisa_on_cuda.utilities.constants import SERVICE_NAME
8
 
9
  ROOT = Path(globals().get("__file__", "./_")).absolute().parent.parent
10
  PROJECT_ROOT_FOLDER = Path(os.getenv("PROJECT_ROOT_FOLDER", ROOT))
samgis_lisa_on_cuda/__version__.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import importlib.metadata
2
+
3
+
4
+ __version__ = importlib.metadata.version(__package__ or __name__)
{samgis β†’ samgis_lisa_on_cuda}/io/__init__.py RENAMED
File without changes
{samgis β†’ samgis_lisa_on_cuda}/io/coordinates_pixel_conversion.py RENAMED
@@ -1,10 +1,10 @@
1
  """functions useful to convert to/from latitude-longitude coordinates to pixel image coordinates"""
2
  from samgis_core.utilities.type_hints import tuple_float, tuple_float_any
3
 
4
- from samgis import app_logger
5
- from samgis.utilities.constants import TILE_SIZE, EARTH_EQUATORIAL_RADIUS
6
- from samgis.utilities.type_hints import ImagePixelCoordinates
7
- from samgis.utilities.type_hints import LatLngDict
8
 
9
 
10
  def _get_latlng2pixel_projection(latlng: LatLngDict) -> ImagePixelCoordinates:
 
1
  """functions useful to convert to/from latitude-longitude coordinates to pixel image coordinates"""
2
  from samgis_core.utilities.type_hints import tuple_float, tuple_float_any
3
 
4
+ from samgis_lisa_on_cuda import app_logger
5
+ from samgis_lisa_on_cuda.utilities.constants import TILE_SIZE, EARTH_EQUATORIAL_RADIUS
6
+ from samgis_lisa_on_cuda.utilities.type_hints import ImagePixelCoordinates
7
+ from samgis_lisa_on_cuda.utilities.type_hints import LatLngDict
8
 
9
 
10
  def _get_latlng2pixel_projection(latlng: LatLngDict) -> ImagePixelCoordinates:
{samgis β†’ samgis_lisa_on_cuda}/io/geo_helpers.py RENAMED
@@ -3,7 +3,7 @@ from affine import Affine
3
  from numpy import ndarray as np_ndarray
4
 
5
  from samgis_core.utilities.type_hints import list_float, tuple_float, dict_str_int
6
- from samgis import app_logger
7
 
8
 
9
  def load_affine_transformation_from_matrix(matrix_source_coefficients: list_float) -> Affine:
 
3
  from numpy import ndarray as np_ndarray
4
 
5
  from samgis_core.utilities.type_hints import list_float, tuple_float, dict_str_int
6
+ from samgis_lisa_on_cuda import app_logger
7
 
8
 
9
  def load_affine_transformation_from_matrix(matrix_source_coefficients: list_float) -> Affine:
{samgis β†’ samgis_lisa_on_cuda}/io/raster_helpers.py RENAMED
@@ -2,8 +2,8 @@
2
  import numpy as np
3
  from numpy import ndarray, bitwise_not
4
 
5
- from samgis import app_logger
6
- from samgis.utilities.type_hints import XYZTerrainProvidersNames
7
 
8
 
9
  def get_nextzen_terrain_rgb_formula(red: ndarray, green: ndarray, blue: ndarray) -> ndarray:
@@ -80,7 +80,7 @@ def get_rgb_prediction_image(raster_cropped: ndarray, slope_cellsize: int, inver
80
  Returns:
81
  tuple of str: image filename, image path (with filename)
82
  """
83
- from samgis.utilities.constants import CHANNEL_EXAGGERATIONS_LIST
84
 
85
  try:
86
  slope, curvature = get_slope_curvature(raster_cropped, slope_cellsize=slope_cellsize)
 
2
  import numpy as np
3
  from numpy import ndarray, bitwise_not
4
 
5
+ from samgis_lisa_on_cuda import app_logger
6
+ from samgis_lisa_on_cuda.utilities.type_hints import XYZTerrainProvidersNames
7
 
8
 
9
  def get_nextzen_terrain_rgb_formula(red: ndarray, green: ndarray, blue: ndarray) -> ndarray:
 
80
  Returns:
81
  tuple of str: image filename, image path (with filename)
82
  """
83
+ from samgis_lisa_on_cuda.utilities.constants import CHANNEL_EXAGGERATIONS_LIST
84
 
85
  try:
86
  slope, curvature = get_slope_curvature(raster_cropped, slope_cellsize=slope_cellsize)
{samgis β†’ samgis_lisa_on_cuda}/io/tms2geotiff.py RENAMED
@@ -4,10 +4,10 @@ from numpy import ndarray
4
  from samgis_core.utilities.type_hints import tuple_float
5
  from xyzservices import TileProvider
6
 
7
- from samgis import app_logger
8
- from samgis.utilities.constants import (OUTPUT_CRS_STRING, DRIVER_RASTERIO_GTIFF, N_MAX_RETRIES, N_CONNECTION, N_WAIT,
9
  ZOOM_AUTO, BOOL_USE_CACHE)
10
- from samgis.utilities.type_hints import tuple_ndarray_transform
11
 
12
 
13
  bool_use_cache = int(os.getenv("BOOL_USE_CACHE", BOOL_USE_CACHE))
@@ -51,8 +51,8 @@ def download_extent(w: float, s: float, e: float, n: float, zoom: int or str = z
51
  parsed request input
52
  """
53
  try:
54
- from samgis import contextily_tile
55
- from samgis.io.coordinates_pixel_conversion import _from4326_to3857
56
 
57
  app_logger.info(f"connection number:{n_connections}, type:{type(n_connections)}.")
58
  app_logger.info(f"zoom:{zoom}, type:{type(zoom)}.")
 
4
  from samgis_core.utilities.type_hints import tuple_float
5
  from xyzservices import TileProvider
6
 
7
+ from samgis_lisa_on_cuda import app_logger
8
+ from samgis_lisa_on_cuda.utilities.constants import (OUTPUT_CRS_STRING, DRIVER_RASTERIO_GTIFF, N_MAX_RETRIES, N_CONNECTION, N_WAIT,
9
  ZOOM_AUTO, BOOL_USE_CACHE)
10
+ from samgis_lisa_on_cuda.utilities.type_hints import tuple_ndarray_transform
11
 
12
 
13
  bool_use_cache = int(os.getenv("BOOL_USE_CACHE", BOOL_USE_CACHE))
 
51
  parsed request input
52
  """
53
  try:
54
+ from samgis_lisa_on_cuda import contextily_tile
55
+ from samgis_lisa_on_cuda.io.coordinates_pixel_conversion import _from4326_to3857
56
 
57
  app_logger.info(f"connection number:{n_connections}, type:{type(n_connections)}.")
58
  app_logger.info(f"zoom:{zoom}, type:{type(zoom)}.")
{samgis β†’ samgis_lisa_on_cuda}/io/wrappers_helpers.py RENAMED
@@ -7,10 +7,10 @@ import loguru
7
  from xyzservices import providers, TileProvider
8
 
9
  from lisa_on_cuda.utils.app_helpers import get_cleaned_input
10
- from samgis import app_logger
11
- from samgis.io.coordinates_pixel_conversion import get_latlng_to_pixel_coordinates
12
- from samgis.utilities.constants import COMPLETE_URL_TILES_MAPBOX, COMPLETE_URL_TILES_NEXTZEN, CUSTOM_RESPONSE_MESSAGES
13
- from samgis.utilities.type_hints import ApiRequestBody, ContentTypes, XYZTerrainProvidersNames, \
14
  XYZDefaultProvidersNames, StringPromptApiRequestBody
15
  from samgis_core.utilities.utilities import base64_decode
16
 
 
7
  from xyzservices import providers, TileProvider
8
 
9
  from lisa_on_cuda.utils.app_helpers import get_cleaned_input
10
+ from samgis_lisa_on_cuda import app_logger
11
+ from samgis_lisa_on_cuda.io.coordinates_pixel_conversion import get_latlng_to_pixel_coordinates
12
+ from samgis_lisa_on_cuda.utilities.constants import COMPLETE_URL_TILES_MAPBOX, COMPLETE_URL_TILES_NEXTZEN, CUSTOM_RESPONSE_MESSAGES
13
+ from samgis_lisa_on_cuda.utilities.type_hints import ApiRequestBody, ContentTypes, XYZTerrainProvidersNames, \
14
  XYZDefaultProvidersNames, StringPromptApiRequestBody
15
  from samgis_core.utilities.utilities import base64_decode
16
 
{samgis β†’ samgis_lisa_on_cuda}/prediction_api/__init__.py RENAMED
File without changes
{samgis β†’ samgis_lisa_on_cuda}/prediction_api/global_models.py RENAMED
File without changes
{samgis β†’ samgis_lisa_on_cuda}/prediction_api/lisa.py RENAMED
@@ -1,8 +1,8 @@
1
- from samgis import app_logger
2
- from samgis.io.geo_helpers import get_vectorized_raster_as_geojson
3
- from samgis.io.tms2geotiff import download_extent
4
- from samgis.prediction_api.global_models import models_dict
5
- from samgis.utilities.constants import DEFAULT_URL_TILES
6
  from samgis_core.utilities.type_hints import llist_float, list_dict, dict_str_int
7
  from lisa_on_cuda.utils import app_helpers
8
 
 
1
+ from samgis_lisa_on_cuda import app_logger
2
+ from samgis_lisa_on_cuda.io.geo_helpers import get_vectorized_raster_as_geojson
3
+ from samgis_lisa_on_cuda.io.tms2geotiff import download_extent
4
+ from samgis_lisa_on_cuda.prediction_api.global_models import models_dict
5
+ from samgis_lisa_on_cuda.utilities.constants import DEFAULT_URL_TILES
6
  from samgis_core.utilities.type_hints import llist_float, list_dict, dict_str_int
7
  from lisa_on_cuda.utils import app_helpers
8
 
{samgis β†’ samgis_lisa_on_cuda}/prediction_api/predictors.py RENAMED
@@ -1,11 +1,11 @@
1
  """functions using machine learning instance model(s)"""
2
- from samgis import app_logger, MODEL_FOLDER
3
- from samgis.io.geo_helpers import get_vectorized_raster_as_geojson
4
- from samgis.io.raster_helpers import get_raster_terrain_rgb_like, get_rgb_prediction_image
5
- from samgis.io.tms2geotiff import download_extent
6
- from samgis.io.wrappers_helpers import check_source_type_is_terrain
7
- from samgis.prediction_api.global_models import models_dict
8
- from samgis.utilities.constants import DEFAULT_URL_TILES, SLOPE_CELLSIZE
9
  from samgis_core.prediction_api.sam_onnx import SegmentAnythingONNX
10
  from samgis_core.prediction_api.sam_onnx import get_raster_inference
11
  from samgis_core.utilities.constants import MODEL_ENCODER_NAME, MODEL_DECODER_NAME, DEFAULT_INPUT_SHAPE
 
1
  """functions using machine learning instance model(s)"""
2
+ from samgis_lisa_on_cuda import app_logger, MODEL_FOLDER
3
+ from samgis_lisa_on_cuda.io.geo_helpers import get_vectorized_raster_as_geojson
4
+ from samgis_lisa_on_cuda.io.raster_helpers import get_raster_terrain_rgb_like, get_rgb_prediction_image
5
+ from samgis_lisa_on_cuda.io.tms2geotiff import download_extent
6
+ from samgis_lisa_on_cuda.io.wrappers_helpers import check_source_type_is_terrain
7
+ from samgis_lisa_on_cuda.prediction_api.global_models import models_dict
8
+ from samgis_lisa_on_cuda.utilities.constants import DEFAULT_URL_TILES, SLOPE_CELLSIZE
9
  from samgis_core.prediction_api.sam_onnx import SegmentAnythingONNX
10
  from samgis_core.prediction_api.sam_onnx import get_raster_inference
11
  from samgis_core.utilities.constants import MODEL_ENCODER_NAME, MODEL_DECODER_NAME, DEFAULT_INPUT_SHAPE
{samgis β†’ samgis_lisa_on_cuda}/utilities/__init__.py RENAMED
File without changes
{samgis β†’ samgis_lisa_on_cuda}/utilities/constants.py RENAMED
File without changes
{samgis β†’ samgis_lisa_on_cuda}/utilities/session_logger.py RENAMED
File without changes
{samgis β†’ samgis_lisa_on_cuda}/utilities/type_hints.py RENAMED
File without changes
scripts/extract-openapi-fastapi.py CHANGED
@@ -7,7 +7,7 @@ import sys
7
  import yaml
8
  from uvicorn.importer import import_from_string
9
 
10
- from samgis import PROJECT_ROOT_FOLDER
11
 
12
  parser = argparse.ArgumentParser(prog="extract-openapi-fastapi.py")
13
  parser.add_argument("app", help='App import string. Eg. "main:app"', default="main:app")
 
7
  import yaml
8
  from uvicorn.importer import import_from_string
9
 
10
+ from samgis_lisa_on_cuda import PROJECT_ROOT_FOLDER
11
 
12
  parser = argparse.ArgumentParser(prog="extract-openapi-fastapi.py")
13
  parser.add_argument("app", help='App import string. Eg. "main:app"', default="main:app")
scripts/extract-openapi-lambda.py CHANGED
@@ -1,9 +1,9 @@
1
  import json
2
 
3
- from samgis import PROJECT_ROOT_FOLDER
4
 
5
  if __name__ == '__main__':
6
- from samgis.utilities.type_hints import ApiRequestBody, ApiResponseBodyFailure, ApiResponseBodySuccess
7
 
8
  with open(PROJECT_ROOT_FOLDER / "docs" / "specs" / "openapi_lambda_wip.json", "w") as output_json:
9
  json.dump({
 
1
  import json
2
 
3
+ from samgis_lisa_on_cuda import PROJECT_ROOT_FOLDER
4
 
5
  if __name__ == '__main__':
6
+ from samgis_lisa_on_cuda.utilities.type_hints import ApiRequestBody, ApiResponseBodyFailure, ApiResponseBodySuccess
7
 
8
  with open(PROJECT_ROOT_FOLDER / "docs" / "specs" / "openapi_lambda_wip.json", "w") as output_json:
9
  json.dump({
static/src/components/PageFooter.vue CHANGED
@@ -7,7 +7,7 @@
7
  <span>Trouble on scrolling this page? Open the
8
  <PageFooterHyperlink path="https://aletrn-samgis-lisa-on-cuda.hf.space">direct URL space</PageFooterHyperlink>
9
  as a new tab. </span>
10
- <span><PageFooterHyperlink path="/">SamGIS</PageFooterHyperlink>: An inference machine learning POC applied to GIS thanks to
11
  <PageFooterHyperlink path="https://github.com/vietanhdev/samexporter/">SAM Exporter</PageFooterHyperlink>
12
  and inspired by
13
  <PageFooterHyperlink path="https://samgeo.gishub.org/">Segment Geospatial</PageFooterHyperlink>
 
7
  <span>Trouble on scrolling this page? Open the
8
  <PageFooterHyperlink path="https://aletrn-samgis-lisa-on-cuda.hf.space">direct URL space</PageFooterHyperlink>
9
  as a new tab. </span>
10
+ <span><PageFooterHyperlink path="/">SamGIS-LISA on cuda</PageFooterHyperlink>: An inference machine learning POC applied to GIS thanks to
11
  <PageFooterHyperlink path="https://github.com/vietanhdev/samexporter/">SAM Exporter</PageFooterHyperlink>
12
  and inspired by
13
  <PageFooterHyperlink path="https://samgeo.gishub.org/">Segment Geospatial</PageFooterHyperlink>
tests/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- from samgis import PROJECT_ROOT_FOLDER
2
 
3
 
4
  TEST_ROOT_FOLDER = PROJECT_ROOT_FOLDER / "tests"
 
1
+ from samgis_lisa_on_cuda import PROJECT_ROOT_FOLDER
2
 
3
 
4
  TEST_ROOT_FOLDER = PROJECT_ROOT_FOLDER / "tests"
tests/io/test_coordinates_pixel_conversion.py CHANGED
@@ -1,7 +1,7 @@
1
  import json
2
 
3
- from samgis.io.coordinates_pixel_conversion import get_latlng_to_pixel_coordinates
4
- from samgis.utilities.type_hints import LatLngDict
5
  from tests import TEST_EVENTS_FOLDER
6
 
7
 
 
1
  import json
2
 
3
+ from samgis_lisa_on_cuda.io.coordinates_pixel_conversion import get_latlng_to_pixel_coordinates
4
+ from samgis_lisa_on_cuda.utilities.type_hints import LatLngDict
5
  from tests import TEST_EVENTS_FOLDER
6
 
7
 
tests/io/test_geo_helpers.py CHANGED
@@ -3,7 +3,7 @@ import unittest
3
  import numpy as np
4
  import shapely
5
 
6
- from samgis.io.geo_helpers import load_affine_transformation_from_matrix
7
  from tests import TEST_EVENTS_FOLDER
8
 
9
 
@@ -63,7 +63,7 @@ class TestGeoHelpers(unittest.TestCase):
63
 
64
  def test_get_vectorized_raster_as_geojson_ok(self):
65
  from rasterio.transform import Affine
66
- from samgis.io.geo_helpers import get_vectorized_raster_as_geojson
67
 
68
  name_fn = "samexporter_predict"
69
 
@@ -81,7 +81,7 @@ class TestGeoHelpers(unittest.TestCase):
81
  assert shapely.equals_exact(output_geojson, expected_output_geojson, tolerance=0.000006)
82
 
83
  def test_get_vectorized_raster_as_geojson_fail(self):
84
- from samgis.io.geo_helpers import get_vectorized_raster_as_geojson
85
 
86
  name_fn = "samexporter_predict"
87
 
 
3
  import numpy as np
4
  import shapely
5
 
6
+ from samgis_lisa_on_cuda.io.geo_helpers import load_affine_transformation_from_matrix
7
  from tests import TEST_EVENTS_FOLDER
8
 
9
 
 
63
 
64
  def test_get_vectorized_raster_as_geojson_ok(self):
65
  from rasterio.transform import Affine
66
+ from samgis_lisa_on_cuda.io.geo_helpers import get_vectorized_raster_as_geojson
67
 
68
  name_fn = "samexporter_predict"
69
 
 
81
  assert shapely.equals_exact(output_geojson, expected_output_geojson, tolerance=0.000006)
82
 
83
  def test_get_vectorized_raster_as_geojson_fail(self):
84
+ from samgis_lisa_on_cuda.io.geo_helpers import get_vectorized_raster_as_geojson
85
 
86
  name_fn = "samexporter_predict"
87
 
tests/io/test_raster_helpers.py CHANGED
@@ -3,7 +3,7 @@ from unittest.mock import patch
3
  import numpy as np
4
 
5
  from samgis_core.utilities.utilities import hash_calculate
6
- from samgis.io import raster_helpers
7
 
8
 
9
  def get_three_channels(size=5, param1=1000, param2=3, param3=-88):
@@ -101,7 +101,7 @@ class Test(unittest.TestCase):
101
  assert hash_slope == b'IYf6x4G0lmR47j6HRS5kUYWdtmimhLz2nak8py75nwc='
102
 
103
  def test_get_slope_curvature_value_error(self):
104
- from samgis.io import raster_helpers
105
 
106
  with self.assertRaises(ValueError):
107
  try:
@@ -242,7 +242,7 @@ class Test(unittest.TestCase):
242
  assert hash_output == b'RU7CcoKoR3Fkh5LE+m48DHRVUy/vGq6UgfOFUMXx07M='
243
 
244
  def test_get_raster_terrain_rgb_like(self):
245
- from samgis.utilities.type_hints import XYZTerrainProvidersNames
246
 
247
  arr_input = raster_helpers.get_rgb_image(channel0, channel1, channel2, invert_image=True)
248
  output_nextzen = raster_helpers.get_raster_terrain_rgb_like(
 
3
  import numpy as np
4
 
5
  from samgis_core.utilities.utilities import hash_calculate
6
+ from samgis_lisa_on_cuda.io import raster_helpers
7
 
8
 
9
  def get_three_channels(size=5, param1=1000, param2=3, param3=-88):
 
101
  assert hash_slope == b'IYf6x4G0lmR47j6HRS5kUYWdtmimhLz2nak8py75nwc='
102
 
103
  def test_get_slope_curvature_value_error(self):
104
+ from samgis_lisa_on_cuda.io import raster_helpers
105
 
106
  with self.assertRaises(ValueError):
107
  try:
 
242
  assert hash_output == b'RU7CcoKoR3Fkh5LE+m48DHRVUy/vGq6UgfOFUMXx07M='
243
 
244
  def test_get_raster_terrain_rgb_like(self):
245
+ from samgis_lisa_on_cuda.utilities.type_hints import XYZTerrainProvidersNames
246
 
247
  arr_input = raster_helpers.get_rgb_image(channel0, channel1, channel2, invert_image=True)
248
  output_nextzen = raster_helpers.get_raster_terrain_rgb_like(
tests/io/test_tms2geotiff.py CHANGED
@@ -3,8 +3,8 @@ import unittest
3
  import numpy as np
4
  from samgis_core.utilities.utilities import hash_calculate
5
 
6
- from samgis import app_logger
7
- from samgis.io.tms2geotiff import download_extent
8
  from tests import LOCAL_URL_TILE, TEST_EVENTS_FOLDER
9
 
10
 
 
3
  import numpy as np
4
  from samgis_core.utilities.utilities import hash_calculate
5
 
6
+ from samgis_lisa_on_cuda import app_logger
7
+ from samgis_lisa_on_cuda.io.tms2geotiff import download_extent
8
  from tests import LOCAL_URL_TILE, TEST_EVENTS_FOLDER
9
 
10
 
tests/io/test_wrappers_helpers.py CHANGED
@@ -5,9 +5,9 @@ import unittest
5
  from http import HTTPStatus
6
  from unittest.mock import patch
7
 
8
- from samgis.io import wrappers_helpers
9
- from samgis.io.wrappers_helpers import get_parsed_bbox_points_with_dictlist_prompt, get_parsed_request_body, get_response
10
- from samgis.utilities.type_hints import ApiRequestBody
11
  from tests import TEST_EVENTS_FOLDER
12
 
13
 
@@ -95,7 +95,7 @@ class WrappersHelpersTest(unittest.TestCase):
95
  @patch.object(wrappers_helpers, "providers")
96
  def test_get_url_tile(self, providers_mocked):
97
  import xyzservices
98
- from samgis.io.wrappers_helpers import get_url_tile
99
 
100
  from tests import LOCAL_URL_TILE
101
 
@@ -115,7 +115,7 @@ class WrappersHelpersTest(unittest.TestCase):
115
 
116
  @staticmethod
117
  def test_get_url_tile_real():
118
- from samgis.io.wrappers_helpers import get_url_tile
119
 
120
  assert get_url_tile("OpenStreetMap") == {
121
  'url': 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 'max_zoom': 19,
 
5
  from http import HTTPStatus
6
  from unittest.mock import patch
7
 
8
+ from samgis_lisa_on_cuda.io import wrappers_helpers
9
+ from samgis_lisa_on_cuda.io.wrappers_helpers import get_parsed_bbox_points_with_dictlist_prompt, get_parsed_request_body, get_response
10
+ from samgis_lisa_on_cuda.utilities.type_hints import ApiRequestBody
11
  from tests import TEST_EVENTS_FOLDER
12
 
13
 
 
95
  @patch.object(wrappers_helpers, "providers")
96
  def test_get_url_tile(self, providers_mocked):
97
  import xyzservices
98
+ from samgis_lisa_on_cuda.io.wrappers_helpers import get_url_tile
99
 
100
  from tests import LOCAL_URL_TILE
101
 
 
115
 
116
  @staticmethod
117
  def test_get_url_tile_real():
118
+ from samgis_lisa_on_cuda.io.wrappers_helpers import get_url_tile
119
 
120
  assert get_url_tile("OpenStreetMap") == {
121
  'url': 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 'max_zoom': 19,
tests/prediction_api/test_predictors.py CHANGED
@@ -3,8 +3,8 @@ from unittest.mock import patch
3
 
4
  import numpy as np
5
 
6
- from samgis.prediction_api import predictors
7
- from samgis.prediction_api.predictors import get_raster_inference, samexporter_predict
8
  from tests import TEST_EVENTS_FOLDER
9
 
10
 
 
3
 
4
  import numpy as np
5
 
6
+ from samgis_lisa_on_cuda.prediction_api import predictors
7
+ from samgis_lisa_on_cuda.prediction_api.predictors import get_raster_inference, samexporter_predict
8
  from tests import TEST_EVENTS_FOLDER
9
 
10
 
tests/test_fastapi_app.py CHANGED
@@ -5,8 +5,8 @@ from unittest.mock import patch
5
 
6
  from fastapi.testclient import TestClient
7
 
8
- from samgis import PROJECT_ROOT_FOLDER
9
- from samgis.io import wrappers_helpers
10
  from tests import TEST_EVENTS_FOLDER
11
  from tests.local_tiles_http_server import LocalTilesHttpServer
12
  from wrappers import fastapi_wrapper
 
5
 
6
  from fastapi.testclient import TestClient
7
 
8
+ from samgis_lisa_on_cuda import PROJECT_ROOT_FOLDER
9
+ from samgis_lisa_on_cuda.io import wrappers_helpers
10
  from tests import TEST_EVENTS_FOLDER
11
  from tests.local_tiles_http_server import LocalTilesHttpServer
12
  from wrappers import fastapi_wrapper
tests/test_lambda_app.py CHANGED
@@ -3,13 +3,13 @@ import time
3
  import unittest
4
  from unittest.mock import patch
5
 
6
- from samgis import IS_AWS_LAMBDA
7
 
8
  if IS_AWS_LAMBDA:
9
  try:
10
  from awslambdaric.lambda_context import LambdaContext
11
 
12
- from samgis.io import wrappers_helpers
13
  from wrappers import lambda_wrapper
14
  from tests.local_tiles_http_server import LocalTilesHttpServer
15
 
 
3
  import unittest
4
  from unittest.mock import patch
5
 
6
+ from samgis_lisa_on_cuda import IS_AWS_LAMBDA
7
 
8
  if IS_AWS_LAMBDA:
9
  try:
10
  from awslambdaric.lambda_context import LambdaContext
11
 
12
+ from samgis_lisa_on_cuda.io import wrappers_helpers
13
  from wrappers import lambda_wrapper
14
  from tests.local_tiles_http_server import LocalTilesHttpServer
15
 
wrappers/fastapi_wrapper.py CHANGED
@@ -8,8 +8,8 @@ from fastapi.responses import FileResponse, JSONResponse
8
  from fastapi.staticfiles import StaticFiles
9
  from pydantic import ValidationError
10
 
11
- from samgis import PROJECT_ROOT_FOLDER, WORKDIR
12
- from samgis.utilities.type_hints import ApiRequestBody, StringPromptApiRequestBody
13
  from samgis_core.utilities.fastapi_logger import setup_logging
14
 
15
 
@@ -39,7 +39,7 @@ async def request_middleware(request, call_next):
39
 
40
  @app.post("/post_test_dictlist")
41
  def post_test_dictlist2(request_input: ApiRequestBody) -> JSONResponse:
42
- from samgis.io.wrappers_helpers import get_parsed_bbox_points_with_dictlist_prompt
43
 
44
  request_body = get_parsed_bbox_points_with_dictlist_prompt(request_input)
45
  app_logger.info(f"request_body:{request_body}.")
@@ -51,17 +51,29 @@ def post_test_dictlist2(request_input: ApiRequestBody) -> JSONResponse:
51
 
52
  @app.get("/health")
53
  async def health() -> JSONResponse:
54
- from samgis.__version__ import __version__ as version
55
- from samgis_core.__version__ import __version__ as version_core
56
 
57
- app_logger.info(f"still alive, version:{version}, core version:{version_core}.")
 
 
 
 
 
 
 
 
 
 
 
 
58
  return JSONResponse(status_code=200, content={"msg": "still alive..."})
59
 
60
 
61
  @app.post("/post_test_string")
62
  def post_test_string(request_input: StringPromptApiRequestBody) -> JSONResponse:
63
  from lisa_on_cuda.utils import app_helpers
64
- from samgis.io.wrappers_helpers import get_parsed_bbox_points_with_string_prompt
65
 
66
  request_body = get_parsed_bbox_points_with_string_prompt(request_input)
67
  app_logger.info(f"request_body:{request_body}.")
@@ -75,8 +87,8 @@ def post_test_string(request_input: StringPromptApiRequestBody) -> JSONResponse:
75
 
76
  @app.post("/infer_lisa")
77
  def infer_lisa(request_input: StringPromptApiRequestBody) -> JSONResponse:
78
- from samgis.prediction_api import lisa
79
- from samgis.io.wrappers_helpers import get_parsed_bbox_points_with_string_prompt
80
 
81
  app_logger.info("starting lisa inference request...")
82
 
@@ -119,10 +131,10 @@ def infer_lisa(request_input: StringPromptApiRequestBody) -> JSONResponse:
119
 
120
  @app.post("/infer_samgis")
121
  def infer_samgis(request_input: ApiRequestBody) -> JSONResponse:
122
- from samgis.prediction_api import predictors
123
- from samgis.io.wrappers_helpers import get_parsed_bbox_points_with_dictlist_prompt
124
 
125
- app_logger.info("starting samgis inference request...")
126
 
127
  try:
128
  import time
@@ -144,10 +156,14 @@ def infer_samgis(request_input: ApiRequestBody) -> JSONResponse:
144
  return JSONResponse(status_code=200, content={"body": json.dumps(body)})
145
  except Exception as inference_exception:
146
  import subprocess
147
- home_content = subprocess.run(
148
- "ls -l /var/task", shell=True, universal_newlines=True, stdout=subprocess.PIPE
 
 
 
 
149
  )
150
- app_logger.error(f"/home/user ls -l: {home_content.stdout}.")
151
  app_logger.error(f"inference error:{inference_exception}.")
152
  raise HTTPException(
153
  status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail="Internal server error on inference")
 
8
  from fastapi.staticfiles import StaticFiles
9
  from pydantic import ValidationError
10
 
11
+ from samgis_lisa_on_cuda import PROJECT_ROOT_FOLDER, WORKDIR
12
+ from samgis_lisa_on_cuda.utilities.type_hints import ApiRequestBody, StringPromptApiRequestBody
13
  from samgis_core.utilities.fastapi_logger import setup_logging
14
 
15
 
 
39
 
40
  @app.post("/post_test_dictlist")
41
  def post_test_dictlist2(request_input: ApiRequestBody) -> JSONResponse:
42
+ from samgis_lisa_on_cuda.io.wrappers_helpers import get_parsed_bbox_points_with_dictlist_prompt
43
 
44
  request_body = get_parsed_bbox_points_with_dictlist_prompt(request_input)
45
  app_logger.info(f"request_body:{request_body}.")
 
51
 
52
  @app.get("/health")
53
  async def health() -> JSONResponse:
54
+ import importlib.metadata
55
+ from importlib.metadata import PackageNotFoundError
56
 
57
+ try:
58
+ core_version = importlib.metadata.version('samgis_core')
59
+ lisa_on_cuda_version = importlib.metadata.version('lisa-on-cuda')
60
+ samgis_lisa_on_cuda_version = importlib.metadata.version('samgis-lisa-on-cuda')
61
+ except PackageNotFoundError as pe:
62
+ app_logger.error(f"pe:{pe}.")
63
+ samgis_lisa_on_cuda_version = "0.0.0"
64
+
65
+ msg = "still alive, "
66
+ msg += f"""version:{samgis_lisa_on_cuda_version}, core version:{core_version},"""
67
+ msg += f"""lisa-on-cuda version:{lisa_on_cuda_version},"""
68
+
69
+ app_logger.info(msg)
70
  return JSONResponse(status_code=200, content={"msg": "still alive..."})
71
 
72
 
73
  @app.post("/post_test_string")
74
  def post_test_string(request_input: StringPromptApiRequestBody) -> JSONResponse:
75
  from lisa_on_cuda.utils import app_helpers
76
+ from samgis_lisa_on_cuda.io.wrappers_helpers import get_parsed_bbox_points_with_string_prompt
77
 
78
  request_body = get_parsed_bbox_points_with_string_prompt(request_input)
79
  app_logger.info(f"request_body:{request_body}.")
 
87
 
88
  @app.post("/infer_lisa")
89
  def infer_lisa(request_input: StringPromptApiRequestBody) -> JSONResponse:
90
+ from samgis_lisa_on_cuda.prediction_api import lisa
91
+ from samgis_lisa_on_cuda.io.wrappers_helpers import get_parsed_bbox_points_with_string_prompt
92
 
93
  app_logger.info("starting lisa inference request...")
94
 
 
131
 
132
  @app.post("/infer_samgis")
133
  def infer_samgis(request_input: ApiRequestBody) -> JSONResponse:
134
+ from samgis_lisa_on_cuda.prediction_api import predictors
135
+ from samgis_lisa_on_cuda.io.wrappers_helpers import get_parsed_bbox_points_with_dictlist_prompt
136
 
137
+ app_logger.info("starting plain samgis inference request...")
138
 
139
  try:
140
  import time
 
156
  return JSONResponse(status_code=200, content={"body": json.dumps(body)})
157
  except Exception as inference_exception:
158
  import subprocess
159
+ project_root_folder_content = subprocess.run(
160
+ f"ls -l {PROJECT_ROOT_FOLDER}/", shell=True, universal_newlines=True, stdout=subprocess.PIPE
161
+ )
162
+ app_logger.error(f"project_root folder 'ls -l' command output: {project_root_folder_content.stdout}.")
163
+ workdir_folder_content = subprocess.run(
164
+ f"ls -l {WORKDIR}/", shell=True, universal_newlines=True, stdout=subprocess.PIPE
165
  )
166
+ app_logger.error(f"workdir folder 'ls -l' command output: {workdir_folder_content.stdout}.")
167
  app_logger.error(f"inference error:{inference_exception}.")
168
  raise HTTPException(
169
  status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail="Internal server error on inference")
wrappers/lambda_wrapper.py CHANGED
@@ -5,9 +5,9 @@ from typing import Dict
5
  from aws_lambda_powertools.utilities.typing import LambdaContext
6
  from pydantic import ValidationError
7
 
8
- from samgis import app_logger
9
- from samgis.io.wrappers_helpers import get_parsed_request_body, get_parsed_bbox_points_with_dictlist_prompt, get_response
10
- from samgis.prediction_api.predictors import samexporter_predict
11
 
12
 
13
  def lambda_handler(event: Dict, context: LambdaContext) -> str:
 
5
  from aws_lambda_powertools.utilities.typing import LambdaContext
6
  from pydantic import ValidationError
7
 
8
+ from samgis_lisa_on_cuda import app_logger
9
+ from samgis_lisa_on_cuda.io.wrappers_helpers import get_parsed_request_body, get_parsed_bbox_points_with_dictlist_prompt, get_response
10
+ from samgis_lisa_on_cuda.prediction_api.predictors import samexporter_predict
11
 
12
 
13
  def lambda_handler(event: Dict, context: LambdaContext) -> str: