alessandro trinca tornidor commited on
Commit
00f8875
β€’
1 Parent(s): 66a0f19

feat: rename io package to 'io_package' to avoid errors on test execution. Add pytest dependency

Browse files
app.py CHANGED
@@ -2,6 +2,7 @@ import json
2
  import os
3
  import pathlib
4
  import uuid
 
5
 
6
  import gradio as gr
7
  import uvicorn
@@ -30,6 +31,37 @@ FASTAPI_TITLE = "samgis-lisa-on-zero"
30
  app = FastAPI(title=FASTAPI_TITLE, version="1.0")
31
 
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  @app.middleware("http")
34
  async def request_middleware(request, call_next):
35
  request_id = str(uuid.uuid4())
@@ -39,8 +71,8 @@ async def request_middleware(request, call_next):
39
  try:
40
  response = await call_next(request)
41
 
42
- except Exception as ex:
43
- app_logger.error(f"Request failed: {ex}")
44
  response = JSONResponse(content={"success": False}, status_code=500)
45
 
46
  finally:
@@ -52,7 +84,7 @@ async def request_middleware(request, call_next):
52
 
53
  @app.post("/post_test_dictlist")
54
  def post_test_dictlist2(request_input: ApiRequestBody) -> JSONResponse:
55
- from samgis_lisa_on_zero.io.wrappers_helpers import get_parsed_bbox_points_with_dictlist_prompt
56
 
57
  request_body = get_parsed_bbox_points_with_dictlist_prompt(request_input)
58
  app_logger.info(f"request_body:{request_body}.")
@@ -86,7 +118,7 @@ async def health() -> JSONResponse:
86
  @app.post("/post_test_string")
87
  def post_test_string(request_input: StringPromptApiRequestBody) -> JSONResponse:
88
  from lisa_on_cuda.utils import app_helpers
89
- from samgis_lisa_on_zero.io.wrappers_helpers import get_parsed_bbox_points_with_string_prompt
90
 
91
  request_body = get_parsed_bbox_points_with_string_prompt(request_input)
92
  app_logger.info(f"request_body:{request_body}.")
@@ -98,9 +130,8 @@ def post_test_string(request_input: StringPromptApiRequestBody) -> JSONResponse:
98
  )
99
 
100
 
101
- @app.post("/infer_lisa")
102
- def infer_lisa(request_input: StringPromptApiRequestBody) -> JSONResponse:
103
- from samgis_lisa_on_zero.io.wrappers_helpers import get_parsed_bbox_points_with_string_prompt, get_source_name
104
  from samgis_lisa_on_zero.prediction_api import lisa
105
  from samgis_lisa_on_zero.utilities.constants import LISA_INFERENCE_FN
106
 
@@ -126,29 +157,26 @@ def infer_lisa(request_input: StringPromptApiRequestBody) -> JSONResponse:
126
  "duration_run": duration_run,
127
  "output": output
128
  }
129
- return JSONResponse(status_code=200, content={"body": json.dumps(body)})
 
 
130
  except Exception as inference_exception:
131
- import subprocess
132
- project_root_folder_content = subprocess.run(
133
- f"ls -l {PROJECT_ROOT_FOLDER}/", shell=True, universal_newlines=True, stdout=subprocess.PIPE
134
- )
135
- app_logger.error(f"project_root folder 'ls -l' command output: {project_root_folder_content.stdout}.")
136
- workdir_folder_content = subprocess.run(
137
- f"ls -l {WORKDIR}/", shell=True, universal_newlines=True, stdout=subprocess.PIPE
138
- )
139
- app_logger.error(f"workdir folder 'ls -l' command output: {workdir_folder_content.stdout}.")
140
- app_logger.error(f"inference error:{inference_exception}.")
141
- raise HTTPException(
142
- status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail="Internal server error on inference")
143
  except ValidationError as va1:
144
  app_logger.error(f"validation error: {str(va1)}.")
145
  raise ValidationError("Unprocessable Entity")
146
 
147
 
 
 
 
 
 
 
148
  @app.post("/infer_samgis")
149
  def infer_samgis(request_input: ApiRequestBody) -> JSONResponse:
150
  from samgis_lisa_on_zero.prediction_api import predictors
151
- from samgis_lisa_on_zero.io.wrappers_helpers import get_parsed_bbox_points_with_dictlist_prompt, get_source_name
152
 
153
  app_logger.info("starting plain samgis inference request...")
154
 
@@ -173,18 +201,7 @@ def infer_samgis(request_input: ApiRequestBody) -> JSONResponse:
173
  }
174
  return JSONResponse(status_code=200, content={"body": json.dumps(body)})
175
  except Exception as inference_exception:
176
- import subprocess
177
- project_root_folder_content = subprocess.run(
178
- f"ls -l {PROJECT_ROOT_FOLDER}/", shell=True, universal_newlines=True, stdout=subprocess.PIPE
179
- )
180
- app_logger.error(f"project_root folder 'ls -l' command output: {project_root_folder_content.stdout}.")
181
- workdir_folder_content = subprocess.run(
182
- f"ls -l {WORKDIR}/", shell=True, universal_newlines=True, stdout=subprocess.PIPE
183
- )
184
- app_logger.error(f"workdir folder 'ls -l' command output: {workdir_folder_content.stdout}.")
185
- app_logger.error(f"inference error:{inference_exception}.")
186
- raise HTTPException(
187
- status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail="Internal server error on inference")
188
  except ValidationError as va1:
189
  app_logger.error(f"validation error: {str(va1)}.")
190
  raise ValidationError("Unprocessable Entity")
@@ -231,9 +248,9 @@ if bool(write_tmp_on_disk):
231
  app_logger.error(f"is folder?{path_write_tmp_on_disk.is_dir()}.")
232
  os.makedirs(write_tmp_on_disk, exist_ok=True)
233
  app.mount("/vis_output", StaticFiles(directory=write_tmp_on_disk), name="vis_output")
234
- except RuntimeError as rerr:
235
- app_logger.error(f"{rerr} while loading the folder write_tmp_on_disk:{write_tmp_on_disk}...")
236
- raise rerr
237
  templates = Jinja2Templates(directory=WORKDIR / "static")
238
 
239
 
@@ -293,7 +310,8 @@ app_helpers.app_logger.info(f"prepared default arguments:{args}.")
293
  inference_fn = app_helpers.get_inference_model_by_args(args, inference_decorator=SPACES_GPU)
294
 
295
  app_helpers.app_logger.info(f"prepared inference_fn function:{inference_fn.__name__}, creating gradio interface...")
296
- io = app_helpers.get_gradio_interface(inference_fn)
 
297
  app_helpers.app_logger.info(
298
  f"created gradio interface, mounting gradio app on url {VITE_GRADIO_URL} within FastAPI...")
299
  app = gr.mount_gradio_app(app, io, path=VITE_GRADIO_URL)
 
2
  import os
3
  import pathlib
4
  import uuid
5
+ from typing import Callable, NoReturn
6
 
7
  import gradio as gr
8
  import uvicorn
 
31
  app = FastAPI(title=FASTAPI_TITLE, version="1.0")
32
 
33
 
34
+ def get_gradio_interface_geojson(
35
+ fn_inference: Callable
36
+ ):
37
+ return gr.Interface(
38
+ fn_inference,
39
+ inputs=[
40
+ gr.Textbox(lines=1, placeholder=None, label="Payload input"),
41
+ ],
42
+ outputs=[
43
+ gr.Textbox(lines=1, placeholder=None, label="Geojson Output")
44
+ ]
45
+ )
46
+
47
+
48
+ def handle_exception_response(exception: Exception) -> NoReturn:
49
+ import subprocess
50
+ project_root_folder_content = subprocess.run(
51
+ f"ls -l {PROJECT_ROOT_FOLDER}/", shell=True, universal_newlines=True, stdout=subprocess.PIPE
52
+ )
53
+ app_logger.error(f"project_root folder 'ls -l' command output: {project_root_folder_content.stdout}.")
54
+ workdir_folder_content = subprocess.run(
55
+ f"ls -l {WORKDIR}/", shell=True, universal_newlines=True, stdout=subprocess.PIPE
56
+ )
57
+ app_logger.error(f"workdir folder 'ls -l' command stdout: {workdir_folder_content.stdout}.")
58
+ app_logger.error(f"workdir folder 'ls -l' command stderr: {workdir_folder_content.stderr}.")
59
+ app_logger.error(f"inference error:{exception}.")
60
+ raise HTTPException(
61
+ status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail="Internal server error on inference"
62
+ )
63
+
64
+
65
  @app.middleware("http")
66
  async def request_middleware(request, call_next):
67
  request_id = str(uuid.uuid4())
 
71
  try:
72
  response = await call_next(request)
73
 
74
+ except Exception as ex_middleware_http:
75
+ app_logger.error(f"Request failed, ex_middleware_http: {ex_middleware_http}")
76
  response = JSONResponse(content={"success": False}, status_code=500)
77
 
78
  finally:
 
84
 
85
  @app.post("/post_test_dictlist")
86
  def post_test_dictlist2(request_input: ApiRequestBody) -> JSONResponse:
87
+ from samgis_lisa_on_zero.io_package.wrappers_helpers import get_parsed_bbox_points_with_dictlist_prompt
88
 
89
  request_body = get_parsed_bbox_points_with_dictlist_prompt(request_input)
90
  app_logger.info(f"request_body:{request_body}.")
 
118
  @app.post("/post_test_string")
119
  def post_test_string(request_input: StringPromptApiRequestBody) -> JSONResponse:
120
  from lisa_on_cuda.utils import app_helpers
121
+ from samgis_lisa_on_zero.io_package.wrappers_helpers import get_parsed_bbox_points_with_string_prompt
122
 
123
  request_body = get_parsed_bbox_points_with_string_prompt(request_input)
124
  app_logger.info(f"request_body:{request_body}.")
 
130
  )
131
 
132
 
133
+ def infer_lisa_gradio(request_input: StringPromptApiRequestBody) -> JSONResponse:
134
+ from samgis_lisa_on_zero.io_package.wrappers_helpers import get_parsed_bbox_points_with_string_prompt, get_source_name
 
135
  from samgis_lisa_on_zero.prediction_api import lisa
136
  from samgis_lisa_on_zero.utilities.constants import LISA_INFERENCE_FN
137
 
 
157
  "duration_run": duration_run,
158
  "output": output
159
  }
160
+ app_logger.info(f"json.dumps(body):{json.dumps(body)}.")
161
+ # return JSONResponse(status_code=200, content={"body": json.dumps(body)})
162
+ return json.dumps(body)
163
  except Exception as inference_exception:
164
+ handle_exception_response(inference_exception)
 
 
 
 
 
 
 
 
 
 
 
165
  except ValidationError as va1:
166
  app_logger.error(f"validation error: {str(va1)}.")
167
  raise ValidationError("Unprocessable Entity")
168
 
169
 
170
+ @app.post("/infer_lisa")
171
+ def infer_lisa(request_input: StringPromptApiRequestBody) -> JSONResponse:
172
+ body = infer_lisa_gradio(request_input=request_input)
173
+ return JSONResponse(status_code=200, content={"body": json.dumps(body)})
174
+
175
+
176
  @app.post("/infer_samgis")
177
  def infer_samgis(request_input: ApiRequestBody) -> JSONResponse:
178
  from samgis_lisa_on_zero.prediction_api import predictors
179
+ from samgis_lisa_on_zero.io_package.wrappers_helpers import get_parsed_bbox_points_with_dictlist_prompt, get_source_name
180
 
181
  app_logger.info("starting plain samgis inference request...")
182
 
 
201
  }
202
  return JSONResponse(status_code=200, content={"body": json.dumps(body)})
203
  except Exception as inference_exception:
204
+ handle_exception_response(inference_exception)
 
 
 
 
 
 
 
 
 
 
 
205
  except ValidationError as va1:
206
  app_logger.error(f"validation error: {str(va1)}.")
207
  raise ValidationError("Unprocessable Entity")
 
248
  app_logger.error(f"is folder?{path_write_tmp_on_disk.is_dir()}.")
249
  os.makedirs(write_tmp_on_disk, exist_ok=True)
250
  app.mount("/vis_output", StaticFiles(directory=write_tmp_on_disk), name="vis_output")
251
+ except RuntimeError as runtime_error:
252
+ app_logger.error(f"{runtime_error} while loading the folder write_tmp_on_disk:{write_tmp_on_disk}...")
253
+ raise runtime_error
254
  templates = Jinja2Templates(directory=WORKDIR / "static")
255
 
256
 
 
310
  inference_fn = app_helpers.get_inference_model_by_args(args, inference_decorator=SPACES_GPU)
311
 
312
  app_helpers.app_logger.info(f"prepared inference_fn function:{inference_fn.__name__}, creating gradio interface...")
313
+ # io_package = app_helpers.get_gradio_interface(inference_fn)
314
+ io = get_gradio_interface_geojson(infer_lisa_gradio)
315
  app_helpers.app_logger.info(
316
  f"created gradio interface, mounting gradio app on url {VITE_GRADIO_URL} within FastAPI...")
317
  app = gr.mount_gradio_app(app, io, path=VITE_GRADIO_URL)
poetry.lock CHANGED
@@ -432,6 +432,73 @@ mypy = ["contourpy[bokeh,docs]", "docutils-stubs", "mypy (==1.8.0)", "types-Pill
432
  test = ["Pillow", "contourpy[test-no-images]", "matplotlib"]
433
  test-no-images = ["pytest", "pytest-cov", "pytest-xdist", "wurlitzer"]
434
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
435
  [[package]]
436
  name = "cycler"
437
  version = "0.12.1"
@@ -506,13 +573,13 @@ idna = ">=2.0.0"
506
 
507
  [[package]]
508
  name = "exceptiongroup"
509
- version = "1.2.1"
510
  description = "Backport of PEP 654 (exception groups)"
511
  optional = false
512
  python-versions = ">=3.7"
513
  files = [
514
- {file = "exceptiongroup-1.2.1-py3-none-any.whl", hash = "sha256:5258b9ed329c5bbdd31a309f53cbfb0b155341807f6ff7606a1e801a891b29ad"},
515
- {file = "exceptiongroup-1.2.1.tar.gz", hash = "sha256:a4785e48b045528f5bfe627b6ad554ff32def154f42372786903b7abcfe1aa16"},
516
  ]
517
 
518
  [package.extras]
@@ -762,21 +829,21 @@ timezone = ["pytz"]
762
 
763
  [[package]]
764
  name = "gradio"
765
- version = "4.37.2"
766
  description = "Python library for easily interacting with trained machine learning models"
767
  optional = false
768
  python-versions = ">=3.8"
769
  files = [
770
- {file = "gradio-4.37.2-py3-none-any.whl", hash = "sha256:dede8c9429fe9d543f3516b0bb1fc3efa4c34a6ef34635cf8adf3f524a5d615a"},
771
- {file = "gradio-4.37.2.tar.gz", hash = "sha256:94132754ad402c91fd12367c5a57fcced34004ba7b4b256cef96457968346a08"},
772
  ]
773
 
774
  [package.dependencies]
775
  aiofiles = ">=22.0,<24.0"
776
- altair = ">=4.2.0,<6.0"
777
  fastapi = "*"
778
  ffmpy = "*"
779
- gradio-client = "1.0.2"
780
  httpx = ">=0.24.1"
781
  huggingface-hub = ">=0.19.3"
782
  importlib-resources = ">=1.3,<7.0"
@@ -805,13 +872,13 @@ oauth = ["authlib", "itsdangerous"]
805
 
806
  [[package]]
807
  name = "gradio-client"
808
- version = "1.0.2"
809
  description = "Python library for easily interacting with trained machine learning models"
810
  optional = false
811
  python-versions = ">=3.8"
812
  files = [
813
- {file = "gradio_client-1.0.2-py3-none-any.whl", hash = "sha256:f0af3fc39e7459b0703e6b3e9d59b6f7db0f2353b3f5e162a01d94d3bfcd5d97"},
814
- {file = "gradio_client-1.0.2.tar.gz", hash = "sha256:3c88136ff64eb9747342efdc706f378ce863396750b463f27e5e114e47052b68"},
815
  ]
816
 
817
  [package.dependencies]
@@ -1000,6 +1067,17 @@ files = [
1000
  docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-lint"]
1001
  testing = ["jaraco.test (>=5.4)", "pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-ruff (>=0.2.1)", "zipp (>=3.17)"]
1002
 
 
 
 
 
 
 
 
 
 
 
 
1003
  [[package]]
1004
  name = "jinja2"
1005
  version = "3.1.4"
@@ -1255,18 +1333,19 @@ testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"]
1255
 
1256
  [[package]]
1257
  name = "markdown2"
1258
- version = "2.4.13"
1259
  description = "A fast and complete Python implementation of Markdown"
1260
  optional = false
1261
- python-versions = ">=3.5, <4"
1262
  files = [
1263
- {file = "markdown2-2.4.13-py2.py3-none-any.whl", hash = "sha256:855bde5cbcceb9beda7c80efdf7f406c23e6079172c497fcfce22fdce998e892"},
1264
- {file = "markdown2-2.4.13.tar.gz", hash = "sha256:18ceb56590da77f2c22382e55be48c15b3c8f0c71d6398def387275e6c347a9f"},
1265
  ]
1266
 
1267
  [package.extras]
1268
- all = ["pygments (>=2.7.3)", "wavedrom"]
1269
  code-syntax-highlighting = ["pygments (>=2.7.3)"]
 
1270
  wavedrom = ["wavedrom"]
1271
 
1272
  [[package]]
@@ -1698,13 +1777,13 @@ sympy = "*"
1698
 
1699
  [[package]]
1700
  name = "openai"
1701
- version = "1.35.12"
1702
  description = "The official Python library for the openai API"
1703
  optional = false
1704
  python-versions = ">=3.7.1"
1705
  files = [
1706
- {file = "openai-1.35.12-py3-none-any.whl", hash = "sha256:c3a8c9be524480ae32a3212b78d90786b112844eb8f96235ebb8bc5f35cb1e72"},
1707
- {file = "openai-1.35.12.tar.gz", hash = "sha256:2dd0f1d9ff34bf6bc89d15246245369d281b2ba01ae07eae5555a00da4b51e0b"},
1708
  ]
1709
 
1710
  [package.dependencies]
@@ -2007,6 +2086,21 @@ tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "pa
2007
  typing = ["typing-extensions"]
2008
  xmp = ["defusedxml"]
2009
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2010
  [[package]]
2011
  name = "protobuf"
2012
  version = "5.27.2"
@@ -2352,6 +2446,46 @@ files = [
2352
  {file = "pyreadline3-3.4.1.tar.gz", hash = "sha256:6f3d1f7b8a31ba32b73917cefc1f28cc660562f39aea8646d30bd6eff21f7bae"},
2353
  ]
2354
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2355
  [[package]]
2356
  name = "python-dateutil"
2357
  version = "2.9.0.post0"
@@ -3067,52 +3201,47 @@ test = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "importlib-metadata
3067
 
3068
  [[package]]
3069
  name = "shapely"
3070
- version = "2.0.4"
3071
  description = "Manipulation and analysis of geometric objects"
3072
  optional = false
3073
  python-versions = ">=3.7"
3074
  files = [
3075
- {file = "shapely-2.0.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:011b77153906030b795791f2fdfa2d68f1a8d7e40bce78b029782ade3afe4f2f"},
3076
- {file = "shapely-2.0.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:9831816a5d34d5170aa9ed32a64982c3d6f4332e7ecfe62dc97767e163cb0b17"},
3077
- {file = "shapely-2.0.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5c4849916f71dc44e19ed370421518c0d86cf73b26e8656192fcfcda08218fbd"},
3078
- {file = "shapely-2.0.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:841f93a0e31e4c64d62ea570d81c35de0f6cea224568b2430d832967536308e6"},
3079
- {file = "shapely-2.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b4431f522b277c79c34b65da128029a9955e4481462cbf7ebec23aab61fc58"},
3080
- {file = "shapely-2.0.4-cp310-cp310-win32.whl", hash = "sha256:92a41d936f7d6743f343be265ace93b7c57f5b231e21b9605716f5a47c2879e7"},
3081
- {file = "shapely-2.0.4-cp310-cp310-win_amd64.whl", hash = "sha256:30982f79f21bb0ff7d7d4a4e531e3fcaa39b778584c2ce81a147f95be1cd58c9"},
3082
- {file = "shapely-2.0.4-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:de0205cb21ad5ddaef607cda9a3191eadd1e7a62a756ea3a356369675230ac35"},
3083
- {file = "shapely-2.0.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7d56ce3e2a6a556b59a288771cf9d091470116867e578bebced8bfc4147fbfd7"},
3084
- {file = "shapely-2.0.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:58b0ecc505bbe49a99551eea3f2e8a9b3b24b3edd2a4de1ac0dc17bc75c9ec07"},
3085
- {file = "shapely-2.0.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:790a168a808bd00ee42786b8ba883307c0e3684ebb292e0e20009588c426da47"},
3086
- {file = "shapely-2.0.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4310b5494271e18580d61022c0857eb85d30510d88606fa3b8314790df7f367d"},
3087
- {file = "shapely-2.0.4-cp311-cp311-win32.whl", hash = "sha256:63f3a80daf4f867bd80f5c97fbe03314348ac1b3b70fb1c0ad255a69e3749879"},
3088
- {file = "shapely-2.0.4-cp311-cp311-win_amd64.whl", hash = "sha256:c52ed79f683f721b69a10fb9e3d940a468203f5054927215586c5d49a072de8d"},
3089
- {file = "shapely-2.0.4-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:5bbd974193e2cc274312da16b189b38f5f128410f3377721cadb76b1e8ca5328"},
3090
- {file = "shapely-2.0.4-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:41388321a73ba1a84edd90d86ecc8bfed55e6a1e51882eafb019f45895ec0f65"},
3091
- {file = "shapely-2.0.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0776c92d584f72f1e584d2e43cfc5542c2f3dd19d53f70df0900fda643f4bae6"},
3092
- {file = "shapely-2.0.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c75c98380b1ede1cae9a252c6dc247e6279403fae38c77060a5e6186c95073ac"},
3093
- {file = "shapely-2.0.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c3e700abf4a37b7b8b90532fa6ed5c38a9bfc777098bc9fbae5ec8e618ac8f30"},
3094
- {file = "shapely-2.0.4-cp312-cp312-win32.whl", hash = "sha256:4f2ab0faf8188b9f99e6a273b24b97662194160cc8ca17cf9d1fb6f18d7fb93f"},
3095
- {file = "shapely-2.0.4-cp312-cp312-win_amd64.whl", hash = "sha256:03152442d311a5e85ac73b39680dd64a9892fa42bb08fd83b3bab4fe6999bfa0"},
3096
- {file = "shapely-2.0.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:994c244e004bc3cfbea96257b883c90a86e8cbd76e069718eb4c6b222a56f78b"},
3097
- {file = "shapely-2.0.4-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:05ffd6491e9e8958b742b0e2e7c346635033d0a5f1a0ea083547fcc854e5d5cf"},
3098
- {file = "shapely-2.0.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2fbdc1140a7d08faa748256438291394967aa54b40009f54e8d9825e75ef6113"},
3099
- {file = "shapely-2.0.4-cp37-cp37m-win32.whl", hash = "sha256:5af4cd0d8cf2912bd95f33586600cac9c4b7c5053a036422b97cfe4728d2eb53"},
3100
- {file = "shapely-2.0.4-cp37-cp37m-win_amd64.whl", hash = "sha256:464157509ce4efa5ff285c646a38b49f8c5ef8d4b340f722685b09bb033c5ccf"},
3101
- {file = "shapely-2.0.4-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:489c19152ec1f0e5c5e525356bcbf7e532f311bff630c9b6bc2db6f04da6a8b9"},
3102
- {file = "shapely-2.0.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:b79bbd648664aa6f44ef018474ff958b6b296fed5c2d42db60078de3cffbc8aa"},
3103
- {file = "shapely-2.0.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:674d7baf0015a6037d5758496d550fc1946f34bfc89c1bf247cabdc415d7747e"},
3104
- {file = "shapely-2.0.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6cd4ccecc5ea5abd06deeaab52fcdba372f649728050c6143cc405ee0c166679"},
3105
- {file = "shapely-2.0.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fb5cdcbbe3080181498931b52a91a21a781a35dcb859da741c0345c6402bf00c"},
3106
- {file = "shapely-2.0.4-cp38-cp38-win32.whl", hash = "sha256:55a38dcd1cee2f298d8c2ebc60fc7d39f3b4535684a1e9e2f39a80ae88b0cea7"},
3107
- {file = "shapely-2.0.4-cp38-cp38-win_amd64.whl", hash = "sha256:ec555c9d0db12d7fd777ba3f8b75044c73e576c720a851667432fabb7057da6c"},
3108
- {file = "shapely-2.0.4-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:3f9103abd1678cb1b5f7e8e1af565a652e036844166c91ec031eeb25c5ca8af0"},
3109
- {file = "shapely-2.0.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:263bcf0c24d7a57c80991e64ab57cba7a3906e31d2e21b455f493d4aab534aaa"},
3110
- {file = "shapely-2.0.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ddf4a9bfaac643e62702ed662afc36f6abed2a88a21270e891038f9a19bc08fc"},
3111
- {file = "shapely-2.0.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:485246fcdb93336105c29a5cfbff8a226949db37b7473c89caa26c9bae52a242"},
3112
- {file = "shapely-2.0.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8de4578e838a9409b5b134a18ee820730e507b2d21700c14b71a2b0757396acc"},
3113
- {file = "shapely-2.0.4-cp39-cp39-win32.whl", hash = "sha256:9dab4c98acfb5fb85f5a20548b5c0abe9b163ad3525ee28822ffecb5c40e724c"},
3114
- {file = "shapely-2.0.4-cp39-cp39-win_amd64.whl", hash = "sha256:31c19a668b5a1eadab82ff070b5a260478ac6ddad3a5b62295095174a8d26398"},
3115
- {file = "shapely-2.0.4.tar.gz", hash = "sha256:5dc736127fac70009b8d309a0eeb74f3e08979e530cf7017f2f507ef62e6cfb8"},
3116
  ]
3117
 
3118
  [package.dependencies]
@@ -3292,6 +3421,17 @@ dev = ["black (==22.3)", "datasets", "numpy", "pytest", "requests"]
3292
  docs = ["setuptools-rust", "sphinx", "sphinx-rtd-theme"]
3293
  testing = ["black (==22.3)", "datasets", "numpy", "pytest", "requests"]
3294
 
 
 
 
 
 
 
 
 
 
 
 
3295
  [[package]]
3296
  name = "tomlkit"
3297
  version = "0.12.0"
@@ -3934,4 +4074,4 @@ files = [
3934
  [metadata]
3935
  lock-version = "2.0"
3936
  python-versions = "~3.10"
3937
- content-hash = "d2047250ae41b0b25cd260a132550fd6df5d6aa8bd7d0f99a02ff068b50ce442"
 
432
  test = ["Pillow", "contourpy[test-no-images]", "matplotlib"]
433
  test-no-images = ["pytest", "pytest-cov", "pytest-xdist", "wurlitzer"]
434
 
435
+ [[package]]
436
+ name = "coverage"
437
+ version = "7.6.0"
438
+ description = "Code coverage measurement for Python"
439
+ optional = false
440
+ python-versions = ">=3.8"
441
+ files = [
442
+ {file = "coverage-7.6.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:dff044f661f59dace805eedb4a7404c573b6ff0cdba4a524141bc63d7be5c7fd"},
443
+ {file = "coverage-7.6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a8659fd33ee9e6ca03950cfdcdf271d645cf681609153f218826dd9805ab585c"},
444
+ {file = "coverage-7.6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7792f0ab20df8071d669d929c75c97fecfa6bcab82c10ee4adb91c7a54055463"},
445
+ {file = "coverage-7.6.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d4b3cd1ca7cd73d229487fa5caca9e4bc1f0bca96526b922d61053ea751fe791"},
446
+ {file = "coverage-7.6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e7e128f85c0b419907d1f38e616c4f1e9f1d1b37a7949f44df9a73d5da5cd53c"},
447
+ {file = "coverage-7.6.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:a94925102c89247530ae1dab7dc02c690942566f22e189cbd53579b0693c0783"},
448
+ {file = "coverage-7.6.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:dcd070b5b585b50e6617e8972f3fbbee786afca71b1936ac06257f7e178f00f6"},
449
+ {file = "coverage-7.6.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:d50a252b23b9b4dfeefc1f663c568a221092cbaded20a05a11665d0dbec9b8fb"},
450
+ {file = "coverage-7.6.0-cp310-cp310-win32.whl", hash = "sha256:0e7b27d04131c46e6894f23a4ae186a6a2207209a05df5b6ad4caee6d54a222c"},
451
+ {file = "coverage-7.6.0-cp310-cp310-win_amd64.whl", hash = "sha256:54dece71673b3187c86226c3ca793c5f891f9fc3d8aa183f2e3653da18566169"},
452
+ {file = "coverage-7.6.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c7b525ab52ce18c57ae232ba6f7010297a87ced82a2383b1afd238849c1ff933"},
453
+ {file = "coverage-7.6.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4bea27c4269234e06f621f3fac3925f56ff34bc14521484b8f66a580aacc2e7d"},
454
+ {file = "coverage-7.6.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ed8d1d1821ba5fc88d4a4f45387b65de52382fa3ef1f0115a4f7a20cdfab0e94"},
455
+ {file = "coverage-7.6.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:01c322ef2bbe15057bc4bf132b525b7e3f7206f071799eb8aa6ad1940bcf5fb1"},
456
+ {file = "coverage-7.6.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:03cafe82c1b32b770a29fd6de923625ccac3185a54a5e66606da26d105f37dac"},
457
+ {file = "coverage-7.6.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:0d1b923fc4a40c5832be4f35a5dab0e5ff89cddf83bb4174499e02ea089daf57"},
458
+ {file = "coverage-7.6.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:4b03741e70fb811d1a9a1d75355cf391f274ed85847f4b78e35459899f57af4d"},
459
+ {file = "coverage-7.6.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:a73d18625f6a8a1cbb11eadc1d03929f9510f4131879288e3f7922097a429f63"},
460
+ {file = "coverage-7.6.0-cp311-cp311-win32.whl", hash = "sha256:65fa405b837060db569a61ec368b74688f429b32fa47a8929a7a2f9b47183713"},
461
+ {file = "coverage-7.6.0-cp311-cp311-win_amd64.whl", hash = "sha256:6379688fb4cfa921ae349c76eb1a9ab26b65f32b03d46bb0eed841fd4cb6afb1"},
462
+ {file = "coverage-7.6.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:f7db0b6ae1f96ae41afe626095149ecd1b212b424626175a6633c2999eaad45b"},
463
+ {file = "coverage-7.6.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:bbdf9a72403110a3bdae77948b8011f644571311c2fb35ee15f0f10a8fc082e8"},
464
+ {file = "coverage-7.6.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9cc44bf0315268e253bf563f3560e6c004efe38f76db03a1558274a6e04bf5d5"},
465
+ {file = "coverage-7.6.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:da8549d17489cd52f85a9829d0e1d91059359b3c54a26f28bec2c5d369524807"},
466
+ {file = "coverage-7.6.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0086cd4fc71b7d485ac93ca4239c8f75732c2ae3ba83f6be1c9be59d9e2c6382"},
467
+ {file = "coverage-7.6.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:1fad32ee9b27350687035cb5fdf9145bc9cf0a094a9577d43e909948ebcfa27b"},
468
+ {file = "coverage-7.6.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:044a0985a4f25b335882b0966625270a8d9db3d3409ddc49a4eb00b0ef5e8cee"},
469
+ {file = "coverage-7.6.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:76d5f82213aa78098b9b964ea89de4617e70e0d43e97900c2778a50856dac605"},
470
+ {file = "coverage-7.6.0-cp312-cp312-win32.whl", hash = "sha256:3c59105f8d58ce500f348c5b56163a4113a440dad6daa2294b5052a10db866da"},
471
+ {file = "coverage-7.6.0-cp312-cp312-win_amd64.whl", hash = "sha256:ca5d79cfdae420a1d52bf177de4bc2289c321d6c961ae321503b2ca59c17ae67"},
472
+ {file = "coverage-7.6.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d39bd10f0ae453554798b125d2f39884290c480f56e8a02ba7a6ed552005243b"},
473
+ {file = "coverage-7.6.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:beb08e8508e53a568811016e59f3234d29c2583f6b6e28572f0954a6b4f7e03d"},
474
+ {file = "coverage-7.6.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b2e16f4cd2bc4d88ba30ca2d3bbf2f21f00f382cf4e1ce3b1ddc96c634bc48ca"},
475
+ {file = "coverage-7.6.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6616d1c9bf1e3faea78711ee42a8b972367d82ceae233ec0ac61cc7fec09fa6b"},
476
+ {file = "coverage-7.6.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ad4567d6c334c46046d1c4c20024de2a1c3abc626817ae21ae3da600f5779b44"},
477
+ {file = "coverage-7.6.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:d17c6a415d68cfe1091d3296ba5749d3d8696e42c37fca5d4860c5bf7b729f03"},
478
+ {file = "coverage-7.6.0-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:9146579352d7b5f6412735d0f203bbd8d00113a680b66565e205bc605ef81bc6"},
479
+ {file = "coverage-7.6.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:cdab02a0a941af190df8782aafc591ef3ad08824f97850b015c8c6a8b3877b0b"},
480
+ {file = "coverage-7.6.0-cp38-cp38-win32.whl", hash = "sha256:df423f351b162a702c053d5dddc0fc0ef9a9e27ea3f449781ace5f906b664428"},
481
+ {file = "coverage-7.6.0-cp38-cp38-win_amd64.whl", hash = "sha256:f2501d60d7497fd55e391f423f965bbe9e650e9ffc3c627d5f0ac516026000b8"},
482
+ {file = "coverage-7.6.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:7221f9ac9dad9492cecab6f676b3eaf9185141539d5c9689d13fd6b0d7de840c"},
483
+ {file = "coverage-7.6.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ddaaa91bfc4477d2871442bbf30a125e8fe6b05da8a0015507bfbf4718228ab2"},
484
+ {file = "coverage-7.6.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c4cbe651f3904e28f3a55d6f371203049034b4ddbce65a54527a3f189ca3b390"},
485
+ {file = "coverage-7.6.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:831b476d79408ab6ccfadaaf199906c833f02fdb32c9ab907b1d4aa0713cfa3b"},
486
+ {file = "coverage-7.6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:46c3d091059ad0b9c59d1034de74a7f36dcfa7f6d3bde782c49deb42438f2450"},
487
+ {file = "coverage-7.6.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:4d5fae0a22dc86259dee66f2cc6c1d3e490c4a1214d7daa2a93d07491c5c04b6"},
488
+ {file = "coverage-7.6.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:07ed352205574aad067482e53dd606926afebcb5590653121063fbf4e2175166"},
489
+ {file = "coverage-7.6.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:49c76cdfa13015c4560702574bad67f0e15ca5a2872c6a125f6327ead2b731dd"},
490
+ {file = "coverage-7.6.0-cp39-cp39-win32.whl", hash = "sha256:482855914928c8175735a2a59c8dc5806cf7d8f032e4820d52e845d1f731dca2"},
491
+ {file = "coverage-7.6.0-cp39-cp39-win_amd64.whl", hash = "sha256:543ef9179bc55edfd895154a51792b01c017c87af0ebaae092720152e19e42ca"},
492
+ {file = "coverage-7.6.0-pp38.pp39.pp310-none-any.whl", hash = "sha256:6fe885135c8a479d3e37a7aae61cbd3a0fb2deccb4dda3c25f92a49189f766d6"},
493
+ {file = "coverage-7.6.0.tar.gz", hash = "sha256:289cc803fa1dc901f84701ac10c9ee873619320f2f9aff38794db4a4a0268d51"},
494
+ ]
495
+
496
+ [package.dependencies]
497
+ tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""}
498
+
499
+ [package.extras]
500
+ toml = ["tomli"]
501
+
502
  [[package]]
503
  name = "cycler"
504
  version = "0.12.1"
 
573
 
574
  [[package]]
575
  name = "exceptiongroup"
576
+ version = "1.2.2"
577
  description = "Backport of PEP 654 (exception groups)"
578
  optional = false
579
  python-versions = ">=3.7"
580
  files = [
581
+ {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"},
582
+ {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"},
583
  ]
584
 
585
  [package.extras]
 
829
 
830
  [[package]]
831
  name = "gradio"
832
+ version = "4.38.1"
833
  description = "Python library for easily interacting with trained machine learning models"
834
  optional = false
835
  python-versions = ">=3.8"
836
  files = [
837
+ {file = "gradio-4.38.1-py3-none-any.whl", hash = "sha256:003c80fccb475869d76ddd9f8f1c7e85d14b0088a7eabc10558304930f33367b"},
838
+ {file = "gradio-4.38.1.tar.gz", hash = "sha256:8c24cb4e8e391b327e4c537e2ed3b57bcfb35d222bf786a657d27469bfc1667c"},
839
  ]
840
 
841
  [package.dependencies]
842
  aiofiles = ">=22.0,<24.0"
843
+ altair = ">=5.0,<6.0"
844
  fastapi = "*"
845
  ffmpy = "*"
846
+ gradio-client = "1.1.0"
847
  httpx = ">=0.24.1"
848
  huggingface-hub = ">=0.19.3"
849
  importlib-resources = ">=1.3,<7.0"
 
872
 
873
  [[package]]
874
  name = "gradio-client"
875
+ version = "1.1.0"
876
  description = "Python library for easily interacting with trained machine learning models"
877
  optional = false
878
  python-versions = ">=3.8"
879
  files = [
880
+ {file = "gradio_client-1.1.0-py3-none-any.whl", hash = "sha256:5f117fa1163f5673f7f45a226919503a3c1747ee4bbfc6002c6a69386e6e5a57"},
881
+ {file = "gradio_client-1.1.0.tar.gz", hash = "sha256:823ef2b9ab9b869ffebc51c994efec1f58132795239fe1090ef7dd9cf474d1e4"},
882
  ]
883
 
884
  [package.dependencies]
 
1067
  docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-lint"]
1068
  testing = ["jaraco.test (>=5.4)", "pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-ruff (>=0.2.1)", "zipp (>=3.17)"]
1069
 
1070
+ [[package]]
1071
+ name = "iniconfig"
1072
+ version = "2.0.0"
1073
+ description = "brain-dead simple config-ini parsing"
1074
+ optional = false
1075
+ python-versions = ">=3.7"
1076
+ files = [
1077
+ {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"},
1078
+ {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"},
1079
+ ]
1080
+
1081
  [[package]]
1082
  name = "jinja2"
1083
  version = "3.1.4"
 
1333
 
1334
  [[package]]
1335
  name = "markdown2"
1336
+ version = "2.5.0"
1337
  description = "A fast and complete Python implementation of Markdown"
1338
  optional = false
1339
+ python-versions = "<4,>=3.8"
1340
  files = [
1341
+ {file = "markdown2-2.5.0-py2.py3-none-any.whl", hash = "sha256:300d4429b620ebc974ef512339a9e08bc080473f95135a91f33906e24e8280c1"},
1342
+ {file = "markdown2-2.5.0.tar.gz", hash = "sha256:9bff02911f8b617b61eb269c4c1a5f9b2087d7ff051604f66a61b63cab30adc2"},
1343
  ]
1344
 
1345
  [package.extras]
1346
+ all = ["latex2mathml", "pygments (>=2.7.3)", "wavedrom"]
1347
  code-syntax-highlighting = ["pygments (>=2.7.3)"]
1348
+ latex = ["latex2mathml"]
1349
  wavedrom = ["wavedrom"]
1350
 
1351
  [[package]]
 
1777
 
1778
  [[package]]
1779
  name = "openai"
1780
+ version = "1.35.13"
1781
  description = "The official Python library for the openai API"
1782
  optional = false
1783
  python-versions = ">=3.7.1"
1784
  files = [
1785
+ {file = "openai-1.35.13-py3-none-any.whl", hash = "sha256:36ec3e93e0d1f243f69be85c89b9221a471c3e450dfd9df16c9829e3cdf63e60"},
1786
+ {file = "openai-1.35.13.tar.gz", hash = "sha256:c684f3945608baf7d2dcc0ef3ee6f3e27e4c66f21076df0b47be45d57e6ae6e4"},
1787
  ]
1788
 
1789
  [package.dependencies]
 
2086
  typing = ["typing-extensions"]
2087
  xmp = ["defusedxml"]
2088
 
2089
+ [[package]]
2090
+ name = "pluggy"
2091
+ version = "1.5.0"
2092
+ description = "plugin and hook calling mechanisms for python"
2093
+ optional = false
2094
+ python-versions = ">=3.8"
2095
+ files = [
2096
+ {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"},
2097
+ {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"},
2098
+ ]
2099
+
2100
+ [package.extras]
2101
+ dev = ["pre-commit", "tox"]
2102
+ testing = ["pytest", "pytest-benchmark"]
2103
+
2104
  [[package]]
2105
  name = "protobuf"
2106
  version = "5.27.2"
 
2446
  {file = "pyreadline3-3.4.1.tar.gz", hash = "sha256:6f3d1f7b8a31ba32b73917cefc1f28cc660562f39aea8646d30bd6eff21f7bae"},
2447
  ]
2448
 
2449
+ [[package]]
2450
+ name = "pytest"
2451
+ version = "8.2.2"
2452
+ description = "pytest: simple powerful testing with Python"
2453
+ optional = false
2454
+ python-versions = ">=3.8"
2455
+ files = [
2456
+ {file = "pytest-8.2.2-py3-none-any.whl", hash = "sha256:c434598117762e2bd304e526244f67bf66bbd7b5d6cf22138be51ff661980343"},
2457
+ {file = "pytest-8.2.2.tar.gz", hash = "sha256:de4bb8104e201939ccdc688b27a89a7be2079b22e2bd2b07f806b6ba71117977"},
2458
+ ]
2459
+
2460
+ [package.dependencies]
2461
+ colorama = {version = "*", markers = "sys_platform == \"win32\""}
2462
+ exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
2463
+ iniconfig = "*"
2464
+ packaging = "*"
2465
+ pluggy = ">=1.5,<2.0"
2466
+ tomli = {version = ">=1", markers = "python_version < \"3.11\""}
2467
+
2468
+ [package.extras]
2469
+ dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"]
2470
+
2471
+ [[package]]
2472
+ name = "pytest-cov"
2473
+ version = "5.0.0"
2474
+ description = "Pytest plugin for measuring coverage."
2475
+ optional = false
2476
+ python-versions = ">=3.8"
2477
+ files = [
2478
+ {file = "pytest-cov-5.0.0.tar.gz", hash = "sha256:5837b58e9f6ebd335b0f8060eecce69b662415b16dc503883a02f45dfeb14857"},
2479
+ {file = "pytest_cov-5.0.0-py3-none-any.whl", hash = "sha256:4f0764a1219df53214206bf1feea4633c3b558a2925c8b59f144f682861ce652"},
2480
+ ]
2481
+
2482
+ [package.dependencies]
2483
+ coverage = {version = ">=5.2.1", extras = ["toml"]}
2484
+ pytest = ">=4.6"
2485
+
2486
+ [package.extras]
2487
+ testing = ["fields", "hunter", "process-tests", "pytest-xdist", "virtualenv"]
2488
+
2489
  [[package]]
2490
  name = "python-dateutil"
2491
  version = "2.9.0.post0"
 
3201
 
3202
  [[package]]
3203
  name = "shapely"
3204
+ version = "2.0.5"
3205
  description = "Manipulation and analysis of geometric objects"
3206
  optional = false
3207
  python-versions = ">=3.7"
3208
  files = [
3209
+ {file = "shapely-2.0.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:89d34787c44f77a7d37d55ae821f3a784fa33592b9d217a45053a93ade899375"},
3210
+ {file = "shapely-2.0.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:798090b426142df2c5258779c1d8d5734ec6942f778dab6c6c30cfe7f3bf64ff"},
3211
+ {file = "shapely-2.0.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:45211276900c4790d6bfc6105cbf1030742da67594ea4161a9ce6812a6721e68"},
3212
+ {file = "shapely-2.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2e119444bc27ca33e786772b81760f2028d930ac55dafe9bc50ef538b794a8e1"},
3213
+ {file = "shapely-2.0.5-cp310-cp310-win32.whl", hash = "sha256:9a4492a2b2ccbeaebf181e7310d2dfff4fdd505aef59d6cb0f217607cb042fb3"},
3214
+ {file = "shapely-2.0.5-cp310-cp310-win_amd64.whl", hash = "sha256:1e5cb5ee72f1bc7ace737c9ecd30dc174a5295fae412972d3879bac2e82c8fae"},
3215
+ {file = "shapely-2.0.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5bbfb048a74cf273db9091ff3155d373020852805a37dfc846ab71dde4be93ec"},
3216
+ {file = "shapely-2.0.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:93be600cbe2fbaa86c8eb70656369f2f7104cd231f0d6585c7d0aa555d6878b8"},
3217
+ {file = "shapely-2.0.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0f8e71bb9a46814019f6644c4e2560a09d44b80100e46e371578f35eaaa9da1c"},
3218
+ {file = "shapely-2.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d5251c28a29012e92de01d2e84f11637eb1d48184ee8f22e2df6c8c578d26760"},
3219
+ {file = "shapely-2.0.5-cp311-cp311-win32.whl", hash = "sha256:35110e80070d664781ec7955c7de557456b25727a0257b354830abb759bf8311"},
3220
+ {file = "shapely-2.0.5-cp311-cp311-win_amd64.whl", hash = "sha256:6c6b78c0007a34ce7144f98b7418800e0a6a5d9a762f2244b00ea560525290c9"},
3221
+ {file = "shapely-2.0.5-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:03bd7b5fa5deb44795cc0a503999d10ae9d8a22df54ae8d4a4cd2e8a93466195"},
3222
+ {file = "shapely-2.0.5-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2ff9521991ed9e201c2e923da014e766c1aa04771bc93e6fe97c27dcf0d40ace"},
3223
+ {file = "shapely-2.0.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1b65365cfbf657604e50d15161ffcc68de5cdb22a601bbf7823540ab4918a98d"},
3224
+ {file = "shapely-2.0.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:21f64e647a025b61b19585d2247137b3a38a35314ea68c66aaf507a1c03ef6fe"},
3225
+ {file = "shapely-2.0.5-cp312-cp312-win32.whl", hash = "sha256:3ac7dc1350700c139c956b03d9c3df49a5b34aaf91d024d1510a09717ea39199"},
3226
+ {file = "shapely-2.0.5-cp312-cp312-win_amd64.whl", hash = "sha256:30e8737983c9d954cd17feb49eb169f02f1da49e24e5171122cf2c2b62d65c95"},
3227
+ {file = "shapely-2.0.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:ff7731fea5face9ec08a861ed351734a79475631b7540ceb0b66fb9732a5f529"},
3228
+ {file = "shapely-2.0.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ff9e520af0c5a578e174bca3c18713cd47a6c6a15b6cf1f50ac17dc8bb8db6a2"},
3229
+ {file = "shapely-2.0.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:49b299b91557b04acb75e9732645428470825061f871a2edc36b9417d66c1fc5"},
3230
+ {file = "shapely-2.0.5-cp37-cp37m-win32.whl", hash = "sha256:b5870633f8e684bf6d1ae4df527ddcb6f3895f7b12bced5c13266ac04f47d231"},
3231
+ {file = "shapely-2.0.5-cp37-cp37m-win_amd64.whl", hash = "sha256:401cb794c5067598f50518e5a997e270cd7642c4992645479b915c503866abed"},
3232
+ {file = "shapely-2.0.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:e91ee179af539100eb520281ba5394919067c6b51824e6ab132ad4b3b3e76dd0"},
3233
+ {file = "shapely-2.0.5-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:8af6f7260f809c0862741ad08b1b89cb60c130ae30efab62320bbf4ee9cc71fa"},
3234
+ {file = "shapely-2.0.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f5456dd522800306ba3faef77c5ba847ec30a0bd73ab087a25e0acdd4db2514f"},
3235
+ {file = "shapely-2.0.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b714a840402cde66fd7b663bb08cacb7211fa4412ea2a209688f671e0d0631fd"},
3236
+ {file = "shapely-2.0.5-cp38-cp38-win32.whl", hash = "sha256:7e8cf5c252fac1ea51b3162be2ec3faddedc82c256a1160fc0e8ddbec81b06d2"},
3237
+ {file = "shapely-2.0.5-cp38-cp38-win_amd64.whl", hash = "sha256:4461509afdb15051e73ab178fae79974387f39c47ab635a7330d7fee02c68a3f"},
3238
+ {file = "shapely-2.0.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:7545a39c55cad1562be302d74c74586f79e07b592df8ada56b79a209731c0219"},
3239
+ {file = "shapely-2.0.5-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4c83a36f12ec8dee2066946d98d4d841ab6512a6ed7eb742e026a64854019b5f"},
3240
+ {file = "shapely-2.0.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:89e640c2cd37378480caf2eeda9a51be64201f01f786d127e78eaeff091ec897"},
3241
+ {file = "shapely-2.0.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:06efe39beafde3a18a21dde169d32f315c57da962826a6d7d22630025200c5e6"},
3242
+ {file = "shapely-2.0.5-cp39-cp39-win32.whl", hash = "sha256:8203a8b2d44dcb366becbc8c3d553670320e4acf0616c39e218c9561dd738d92"},
3243
+ {file = "shapely-2.0.5-cp39-cp39-win_amd64.whl", hash = "sha256:7fed9dbfbcfec2682d9a047b9699db8dcc890dfca857ecba872c42185fc9e64e"},
3244
+ {file = "shapely-2.0.5.tar.gz", hash = "sha256:bff2366bc786bfa6cb353d6b47d0443c570c32776612e527ee47b6df63fcfe32"},
 
 
 
 
 
3245
  ]
3246
 
3247
  [package.dependencies]
 
3421
  docs = ["setuptools-rust", "sphinx", "sphinx-rtd-theme"]
3422
  testing = ["black (==22.3)", "datasets", "numpy", "pytest", "requests"]
3423
 
3424
+ [[package]]
3425
+ name = "tomli"
3426
+ version = "2.0.1"
3427
+ description = "A lil' TOML parser"
3428
+ optional = false
3429
+ python-versions = ">=3.7"
3430
+ files = [
3431
+ {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
3432
+ {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
3433
+ ]
3434
+
3435
  [[package]]
3436
  name = "tomlkit"
3437
  version = "0.12.0"
 
4074
  [metadata]
4075
  lock-version = "2.0"
4076
  python-versions = "~3.10"
4077
+ content-hash = "54a69094c5b62a8e766dbcba310e0d11aca34a546bfd2ef293441b31a3b781db"
pyproject.toml CHANGED
@@ -35,6 +35,14 @@ loguru = "^0.7.2"
35
  pydantic = "^2.8.2"
36
  uvicorn = "^0.30.1"
37
 
 
 
 
 
 
 
 
 
38
  [build-system]
39
  requires = ["poetry-core"]
40
  build-backend = "poetry.core.masonry.api"
 
35
  pydantic = "^2.8.2"
36
  uvicorn = "^0.30.1"
37
 
38
+ [tool.poetry.group.test]
39
+ optional = true
40
+
41
+ [tool.poetry.group.test.dependencies]
42
+ pytest = "^8.2.2"
43
+ pytest-cov = "^5.0.0"
44
+ httpx = "^0.27.0"
45
+
46
  [build-system]
47
  requires = ["poetry-core"]
48
  build-backend = "poetry.core.masonry.api"
samgis_lisa_on_zero/__init__.py CHANGED
@@ -1,7 +1,7 @@
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_zero.io.tms2geotiff
5
  from contextily import tile as contextily_tile
6
  from pathlib import Path
7
  from samgis_lisa_on_zero.utilities.constants import SERVICE_NAME
 
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_zero.io_package.tms2geotiff
5
  from contextily import tile as contextily_tile
6
  from pathlib import Path
7
  from samgis_lisa_on_zero.utilities.constants import SERVICE_NAME
samgis_lisa_on_zero/{io β†’ io_package}/__init__.py RENAMED
File without changes
samgis_lisa_on_zero/{io β†’ io_package}/coordinates_pixel_conversion.py RENAMED
File without changes
samgis_lisa_on_zero/{io β†’ io_package}/geo_helpers.py RENAMED
File without changes
samgis_lisa_on_zero/{io β†’ io_package}/raster_helpers.py RENAMED
File without changes
samgis_lisa_on_zero/{io β†’ io_package}/tms2geotiff.py RENAMED
@@ -52,7 +52,7 @@ def download_extent(w: float, s: float, e: float, n: float, zoom: int or str = z
52
  """
53
  try:
54
  from samgis_lisa_on_zero import contextily_tile
55
- from samgis_lisa_on_zero.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)}.")
 
52
  """
53
  try:
54
  from samgis_lisa_on_zero import contextily_tile
55
+ from samgis_lisa_on_zero.io_package.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_lisa_on_zero/{io β†’ io_package}/wrappers_helpers.py RENAMED
@@ -8,7 +8,7 @@ from xyzservices import providers, TileProvider
8
 
9
  from lisa_on_cuda.utils.app_helpers import get_cleaned_input
10
  from samgis_lisa_on_zero import app_logger
11
- from samgis_lisa_on_zero.io.coordinates_pixel_conversion import get_latlng_to_pixel_coordinates
12
  from samgis_lisa_on_zero.utilities.constants import COMPLETE_URL_TILES_MAPBOX, COMPLETE_URL_TILES_NEXTZEN, CUSTOM_RESPONSE_MESSAGES
13
  from samgis_lisa_on_zero.utilities.type_hints import ApiRequestBody, ContentTypes, XYZTerrainProvidersNames, \
14
  XYZDefaultProvidersNames, StringPromptApiRequestBody
@@ -58,7 +58,11 @@ def get_parsed_bbox_points_with_string_prompt(request_input: StringPromptApiRequ
58
  dict with bounding box, prompt string and zoom
59
  """
60
 
61
- app_logger.info(f"try to parsing input request {request_input}...")
 
 
 
 
62
 
63
  bbox = request_input.bbox
64
  app_logger.debug(f"request bbox: {type(bbox)}, value:{bbox}.")
 
8
 
9
  from lisa_on_cuda.utils.app_helpers import get_cleaned_input
10
  from samgis_lisa_on_zero import app_logger
11
+ from samgis_lisa_on_zero.io_package.coordinates_pixel_conversion import get_latlng_to_pixel_coordinates
12
  from samgis_lisa_on_zero.utilities.constants import COMPLETE_URL_TILES_MAPBOX, COMPLETE_URL_TILES_NEXTZEN, CUSTOM_RESPONSE_MESSAGES
13
  from samgis_lisa_on_zero.utilities.type_hints import ApiRequestBody, ContentTypes, XYZTerrainProvidersNames, \
14
  XYZDefaultProvidersNames, StringPromptApiRequestBody
 
58
  dict with bounding box, prompt string and zoom
59
  """
60
 
61
+ app_logger.info(f"try to parsing input request: {type(request_input)}, {request_input}...")
62
+ if isinstance(request_input, str):
63
+ app_logger.info(f"string/json input, parsing it to {type(StringPromptApiRequestBody)}...")
64
+ request_input = StringPromptApiRequestBody.model_validate_json(request_input)
65
+ app_logger.info(f"parsed input, now of type {type(request_input)}...")
66
 
67
  bbox = request_input.bbox
68
  app_logger.debug(f"request bbox: {type(bbox)}, value:{bbox}.")
samgis_lisa_on_zero/prediction_api/lisa.py CHANGED
@@ -2,9 +2,9 @@ from datetime import datetime
2
  from spaces import GPU as SPACES_GPU
3
 
4
  from samgis_core.utilities.type_hints import LlistFloat, DictStrInt
5
- from samgis_lisa_on_zero.io.geo_helpers import get_vectorized_raster_as_geojson
6
- from samgis_lisa_on_zero.io.raster_helpers import write_raster_png, write_raster_tiff
7
- from samgis_lisa_on_zero.io.tms2geotiff import download_extent
8
  from samgis_lisa_on_zero.utilities.constants import DEFAULT_URL_TILES, LISA_INFERENCE_FN
9
 
10
  msg_write_tmp_on_disk = "found option to write images and geojson output..."
@@ -16,7 +16,7 @@ def load_model_and_inference_fn(inference_function_name_key: str):
16
  from samgis_lisa_on_zero.prediction_api.global_models import models_dict
17
 
18
  if models_dict[inference_function_name_key]["inference"] is None:
19
- app_logger.info(f"missing inference function {inference_function_name_key}, instantiating it now!")
20
  parsed_args = app_helpers.parse_args([])
21
  inference_fn = app_helpers.get_inference_model_by_args(
22
  parsed_args,
 
2
  from spaces import GPU as SPACES_GPU
3
 
4
  from samgis_core.utilities.type_hints import LlistFloat, DictStrInt
5
+ from samgis_lisa_on_zero.io_package.geo_helpers import get_vectorized_raster_as_geojson
6
+ from samgis_lisa_on_zero.io_package.raster_helpers import write_raster_png, write_raster_tiff
7
+ from samgis_lisa_on_zero.io_package.tms2geotiff import download_extent
8
  from samgis_lisa_on_zero.utilities.constants import DEFAULT_URL_TILES, LISA_INFERENCE_FN
9
 
10
  msg_write_tmp_on_disk = "found option to write images and geojson output..."
 
16
  from samgis_lisa_on_zero.prediction_api.global_models import models_dict
17
 
18
  if models_dict[inference_function_name_key]["inference"] is None:
19
+ app_logger.info(f"missing inference function {inference_function_name_key}, instantiating it now using inference_decorator {SPACES_GPU}!")
20
  parsed_args = app_helpers.parse_args([])
21
  inference_fn = app_helpers.get_inference_model_by_args(
22
  parsed_args,
samgis_lisa_on_zero/prediction_api/predictors.py CHANGED
@@ -1,9 +1,9 @@
1
  """functions using machine learning instance model(s)"""
2
  from samgis_lisa_on_zero import app_logger, MODEL_FOLDER
3
- from samgis_lisa_on_zero.io.geo_helpers import get_vectorized_raster_as_geojson
4
- from samgis_lisa_on_zero.io.raster_helpers import get_raster_terrain_rgb_like, get_rgb_prediction_image
5
- from samgis_lisa_on_zero.io.tms2geotiff import download_extent
6
- from samgis_lisa_on_zero.io.wrappers_helpers import check_source_type_is_terrain
7
  from samgis_lisa_on_zero.prediction_api.global_models import models_dict, embedding_dict
8
  from samgis_lisa_on_zero.utilities.constants import DEFAULT_URL_TILES, SLOPE_CELLSIZE
9
  from samgis_core.prediction_api import sam_onnx2, sam_onnx_inference
 
1
  """functions using machine learning instance model(s)"""
2
  from samgis_lisa_on_zero import app_logger, MODEL_FOLDER
3
+ from samgis_lisa_on_zero.io_package.geo_helpers import get_vectorized_raster_as_geojson
4
+ from samgis_lisa_on_zero.io_package.raster_helpers import get_raster_terrain_rgb_like, get_rgb_prediction_image
5
+ from samgis_lisa_on_zero.io_package.tms2geotiff import download_extent
6
+ from samgis_lisa_on_zero.io_package.wrappers_helpers import check_source_type_is_terrain
7
  from samgis_lisa_on_zero.prediction_api.global_models import models_dict, embedding_dict
8
  from samgis_lisa_on_zero.utilities.constants import DEFAULT_URL_TILES, SLOPE_CELLSIZE
9
  from samgis_core.prediction_api import sam_onnx2, sam_onnx_inference
tests/{io β†’ io_package}/__init__.py RENAMED
File without changes
tests/{io β†’ io_package}/test_coordinates_pixel_conversion.py RENAMED
@@ -1,6 +1,6 @@
1
  import json
2
 
3
- from samgis_lisa_on_zero.io.coordinates_pixel_conversion import get_latlng_to_pixel_coordinates
4
  from samgis_lisa_on_zero.utilities.type_hints import LatLngDict
5
  from tests import TEST_EVENTS_FOLDER
6
 
 
1
  import json
2
 
3
+ from samgis_lisa_on_zero.io_package.coordinates_pixel_conversion import get_latlng_to_pixel_coordinates
4
  from samgis_lisa_on_zero.utilities.type_hints import LatLngDict
5
  from tests import TEST_EVENTS_FOLDER
6
 
tests/{io β†’ io_package}/test_geo_helpers.py RENAMED
@@ -3,7 +3,7 @@ import unittest
3
  import numpy as np
4
  import shapely
5
 
6
- from samgis_lisa_on_zero.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_lisa_on_zero.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_lisa_on_zero.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_zero.io_package.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_zero.io_package.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_zero.io_package.geo_helpers import get_vectorized_raster_as_geojson
85
 
86
  name_fn = "samexporter_predict"
87
 
tests/{io β†’ io_package}/test_raster_helpers.py RENAMED
@@ -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_lisa_on_zero.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_lisa_on_zero.io import raster_helpers
105
 
106
  with self.assertRaises(ValueError):
107
  try:
 
3
  import numpy as np
4
 
5
  from samgis_core.utilities.utilities import hash_calculate
6
+ from samgis_lisa_on_zero.io_package 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_zero.io_package import raster_helpers
105
 
106
  with self.assertRaises(ValueError):
107
  try:
tests/{io β†’ io_package}/test_tms2geotiff.py RENAMED
@@ -4,7 +4,7 @@ import numpy as np
4
  from samgis_core.utilities.utilities import hash_calculate
5
 
6
  from samgis_lisa_on_zero import app_logger
7
- from samgis_lisa_on_zero.io.tms2geotiff import download_extent
8
  from tests import LOCAL_URL_TILE, TEST_EVENTS_FOLDER
9
 
10
 
 
4
  from samgis_core.utilities.utilities import hash_calculate
5
 
6
  from samgis_lisa_on_zero import app_logger
7
+ from samgis_lisa_on_zero.io_package.tms2geotiff import download_extent
8
  from tests import LOCAL_URL_TILE, TEST_EVENTS_FOLDER
9
 
10
 
tests/{io β†’ io_package}/test_wrappers_helpers.py RENAMED
@@ -5,8 +5,8 @@ import unittest
5
  from http import HTTPStatus
6
  from unittest.mock import patch
7
 
8
- from samgis_lisa_on_zero.io import wrappers_helpers
9
- from samgis_lisa_on_zero.io.wrappers_helpers import get_parsed_bbox_points_with_dictlist_prompt, get_parsed_request_body, get_response
10
  from samgis_lisa_on_zero.utilities.type_hints import ApiRequestBody
11
  from tests import TEST_EVENTS_FOLDER
12
 
@@ -92,10 +92,27 @@ class WrappersHelpersTest(unittest.TestCase):
92
  output = get_parsed_request_body(event)
93
  assert output == ApiRequestBody.model_validate(expected_output_dict)
94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  @patch.object(wrappers_helpers, "providers")
96
  def test_get_url_tile(self, providers_mocked):
97
  import xyzservices
98
- from samgis_lisa_on_zero.io.wrappers_helpers import get_url_tile
99
 
100
  from tests import LOCAL_URL_TILE
101
 
@@ -115,7 +132,7 @@ class WrappersHelpersTest(unittest.TestCase):
115
 
116
  @staticmethod
117
  def test_get_url_tile_real():
118
- from samgis_lisa_on_zero.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_zero.io_package import wrappers_helpers
9
+ from samgis_lisa_on_zero.io_package.wrappers_helpers import get_parsed_bbox_points_with_dictlist_prompt, get_parsed_request_body, get_response
10
  from samgis_lisa_on_zero.utilities.type_hints import ApiRequestBody
11
  from tests import TEST_EVENTS_FOLDER
12
 
 
92
  output = get_parsed_request_body(event)
93
  assert output == ApiRequestBody.model_validate(expected_output_dict)
94
 
95
+ def test_get_parsed_bbox_points_with_string_prompt(self):
96
+ from samgis_lisa_on_zero.io_package.wrappers_helpers import get_parsed_bbox_points_with_string_prompt
97
+ req = {
98
+ "bbox":{
99
+ "ne":{"lat":46.17271333276639,"lng":10.079505443573},"sw":{"lat":46.1677724417049,"lng":10.068830251693727}
100
+ },
101
+ "string_prompt":"You are a ...",
102
+ "zoom":17,
103
+ "source_type":"Esri.WorldImagery"
104
+ }
105
+ print(req)
106
+ out = get_parsed_bbox_points_with_string_prompt(json.dumps(req))
107
+ assert isinstance(out, dict)
108
+ for out_k, req_k in zip(out.keys(), req.keys()):
109
+ assert isinstance(out_k, str)
110
+ assert isinstance(req_k, str)
111
+
112
  @patch.object(wrappers_helpers, "providers")
113
  def test_get_url_tile(self, providers_mocked):
114
  import xyzservices
115
+ from samgis_lisa_on_zero.io_package.wrappers_helpers import get_url_tile
116
 
117
  from tests import LOCAL_URL_TILE
118
 
 
132
 
133
  @staticmethod
134
  def test_get_url_tile_real():
135
+ from samgis_lisa_on_zero.io_package.wrappers_helpers import get_url_tile
136
 
137
  assert get_url_tile("OpenStreetMap") == {
138
  'url': 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', 'max_zoom': 19,
tests/test_fastapi_app.py CHANGED
@@ -6,7 +6,7 @@ from unittest.mock import patch
6
  from fastapi.testclient import TestClient
7
 
8
  from samgis_lisa_on_zero import PROJECT_ROOT_FOLDER
9
- from samgis_lisa_on_zero.io import wrappers_helpers
10
  from tests import TEST_EVENTS_FOLDER
11
  from tests.local_tiles_http_server import LocalTilesHttpServer
12
  import app
 
6
  from fastapi.testclient import TestClient
7
 
8
  from samgis_lisa_on_zero import PROJECT_ROOT_FOLDER
9
+ from samgis_lisa_on_zero.io_package import wrappers_helpers
10
  from tests import TEST_EVENTS_FOLDER
11
  from tests.local_tiles_http_server import LocalTilesHttpServer
12
  import app
tests/test_lambda_app.py CHANGED
@@ -9,7 +9,7 @@ if IS_AWS_LAMBDA:
9
  try:
10
  from awslambdaric.lambda_context import LambdaContext
11
 
12
- from samgis_lisa_on_zero.io import wrappers_helpers
13
  from wrappers import lambda_wrapper
14
  from tests.local_tiles_http_server import LocalTilesHttpServer
15
 
 
9
  try:
10
  from awslambdaric.lambda_context import LambdaContext
11
 
12
+ from samgis_lisa_on_zero.io_package import wrappers_helpers
13
  from wrappers import lambda_wrapper
14
  from tests.local_tiles_http_server import LocalTilesHttpServer
15