alessandro trinca tornidor
commited on
Commit
•
5350122
1
Parent(s):
c02ded8
[chore] sync with samgis-be (pyproject.toml, PageLisaMap.vue), update HF space card title
Browse files- README.md +1 -1
- poetry.lock +8 -8
- pyproject.toml +3 -3
- samgis/__version__.py +1 -1
- samgis/prediction_api/lisa.py +1 -0
- static/index.html +1 -1
- static/src/components/PageLisaMap.vue +1 -0
- wrappers/fastapi_wrapper.py +6 -3
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
title: SamGIS
|
3 |
emoji: 🗺️
|
4 |
colorFrom: red
|
5 |
colorTo: blue
|
|
|
1 |
---
|
2 |
+
title: SamGIS - LISA on CUDA
|
3 |
emoji: 🗺️
|
4 |
colorFrom: red
|
5 |
colorTo: blue
|
poetry.lock
CHANGED
@@ -1197,13 +1197,13 @@ files = [
|
|
1197 |
|
1198 |
[[package]]
|
1199 |
name = "importlib-resources"
|
1200 |
-
version = "6.3.
|
1201 |
description = "Read resources from Python packages"
|
1202 |
optional = false
|
1203 |
python-versions = ">=3.8"
|
1204 |
files = [
|
1205 |
-
{file = "importlib_resources-6.3.
|
1206 |
-
{file = "importlib_resources-6.3.
|
1207 |
]
|
1208 |
|
1209 |
[package.extras]
|
@@ -1443,7 +1443,7 @@ uvicorn = "^0.28.0"
|
|
1443 |
|
1444 |
[package.source]
|
1445 |
type = "git"
|
1446 |
-
url = "
|
1447 |
reference = "packaging"
|
1448 |
resolved_reference = "910b2411812e8ecc9e336909dec4b5a698f3506c"
|
1449 |
|
@@ -3396,7 +3396,7 @@ torch = ["safetensors[numpy]", "torch (>=1.10)"]
|
|
3396 |
|
3397 |
[[package]]
|
3398 |
name = "samgis-core"
|
3399 |
-
version = "1.0.
|
3400 |
description = "SamGIS CORE"
|
3401 |
optional = false
|
3402 |
python-versions = "^3.10"
|
@@ -3413,9 +3413,9 @@ pillow = "^10.2.0"
|
|
3413 |
|
3414 |
[package.source]
|
3415 |
type = "git"
|
3416 |
-
url = "
|
3417 |
reference = "dev"
|
3418 |
-
resolved_reference = "
|
3419 |
|
3420 |
[[package]]
|
3421 |
name = "scipy"
|
@@ -4453,4 +4453,4 @@ files = [
|
|
4453 |
[metadata]
|
4454 |
lock-version = "2.0"
|
4455 |
python-versions = "^3.10"
|
4456 |
-
content-hash = "
|
|
|
1197 |
|
1198 |
[[package]]
|
1199 |
name = "importlib-resources"
|
1200 |
+
version = "6.3.1"
|
1201 |
description = "Read resources from Python packages"
|
1202 |
optional = false
|
1203 |
python-versions = ">=3.8"
|
1204 |
files = [
|
1205 |
+
{file = "importlib_resources-6.3.1-py3-none-any.whl", hash = "sha256:4811639ca7fa830abdb8e9ca0a104dc6ad13de691d9fe0d3173a71304f068159"},
|
1206 |
+
{file = "importlib_resources-6.3.1.tar.gz", hash = "sha256:29a3d16556e330c3c8fb8202118c5ff41241cc34cbfb25989bbad226d99b7995"},
|
1207 |
]
|
1208 |
|
1209 |
[package.extras]
|
|
|
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 |
|
|
|
3396 |
|
3397 |
[[package]]
|
3398 |
name = "samgis-core"
|
3399 |
+
version = "1.0.5"
|
3400 |
description = "SamGIS CORE"
|
3401 |
optional = false
|
3402 |
python-versions = "^3.10"
|
|
|
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"
|
|
|
4453 |
[metadata]
|
4454 |
lock-version = "2.0"
|
4455 |
python-versions = "^3.10"
|
4456 |
+
content-hash = "b53d09cabb776f3009ca99021624310b3da5cc8172b64de8cc694cd32dd7451c"
|
pyproject.toml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
[tool.poetry]
|
2 |
-
name = "samgis"
|
3 |
-
version = "1.2.
|
4 |
-
description = "A backend for machine learning instance segmentation on geospatial data
|
5 |
authors = ["alessandro trinca tornidor <alessandro@trinca.tornidor.com>"]
|
6 |
license = "MIT license"
|
7 |
readme = "README.md"
|
|
|
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"
|
samgis/__version__.py
CHANGED
@@ -1 +1 @@
|
|
1 |
-
__version__ = "1.2.
|
|
|
1 |
+
__version__ = "1.2.3"
|
samgis/prediction_api/lisa.py
CHANGED
@@ -32,6 +32,7 @@ def lisa_predict(
|
|
32 |
Returns:
|
33 |
Affine transform
|
34 |
"""
|
|
|
35 |
if models_dict[inference_function_name_key]["inference"] is None:
|
36 |
app_logger.info(f"missing inference function {inference_function_name_key}, instantiating it now!")
|
37 |
parsed_args = app_helpers.parse_args([])
|
|
|
32 |
Returns:
|
33 |
Affine transform
|
34 |
"""
|
35 |
+
app_logger.info("start lisa inference...")
|
36 |
if models_dict[inference_function_name_key]["inference"] is None:
|
37 |
app_logger.info(f"missing inference function {inference_function_name_key}, instantiating it now!")
|
38 |
parsed_args = app_helpers.parse_args([])
|
static/index.html
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
10 |
<link rel="apple-touch-icon" href="/apple-touch-icon.png"><!-- 180×180 -->
|
11 |
<link rel="manifest" href="/manifest.webmanifest">
|
12 |
-
<title>
|
13 |
</head>
|
14 |
<body>
|
15 |
<div id="root"></div>
|
|
|
9 |
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
10 |
<link rel="apple-touch-icon" href="/apple-touch-icon.png"><!-- 180×180 -->
|
11 |
<link rel="manifest" href="/manifest.webmanifest">
|
12 |
+
<title>SamGIS</title>
|
13 |
</head>
|
14 |
<body>
|
15 |
<div id="root"></div>
|
static/src/components/PageLisaMap.vue
CHANGED
@@ -20,6 +20,7 @@
|
|
20 |
<StringArray
|
21 |
:string-array="promptTextArray"
|
22 |
:string-prefix="promptTextPlaceholderRef"
|
|
|
23 |
/>
|
24 |
</div>
|
25 |
|
|
|
20 |
<StringArray
|
21 |
:string-array="promptTextArray"
|
22 |
:string-prefix="promptTextPlaceholderRef"
|
23 |
+
@set-prompt="(stringPrompt: string) => promptTextRef = stringPrompt"
|
24 |
/>
|
25 |
</div>
|
26 |
|
wrappers/fastapi_wrapper.py
CHANGED
@@ -11,7 +11,6 @@ from pydantic import ValidationError
|
|
11 |
from samgis import PROJECT_ROOT_FOLDER
|
12 |
from samgis.utilities.type_hints import ApiRequestBody, StringPromptApiRequestBody
|
13 |
from samgis_core.utilities.fastapi_logger import setup_logging
|
14 |
-
from samgis.prediction_api import predictors, lisa
|
15 |
|
16 |
|
17 |
app_logger = setup_logging(debug=True)
|
@@ -54,8 +53,9 @@ def post_test_dictlist2(request_input: ApiRequestBody) -> JSONResponse:
|
|
54 |
async def health() -> JSONResponse:
|
55 |
from samgis.__version__ import __version__ as version
|
56 |
from samgis_core.__version__ import __version__ as version_core
|
|
|
57 |
|
58 |
-
app_logger.info(f"still alive, version:{version},
|
59 |
return JSONResponse(status_code=200, content={"msg": "still alive..."})
|
60 |
|
61 |
|
@@ -76,6 +76,7 @@ def post_test_string(request_input: StringPromptApiRequestBody) -> JSONResponse:
|
|
76 |
|
77 |
@app.post("/infer_lisa")
|
78 |
def infer_lisa(request_input: StringPromptApiRequestBody) -> JSONResponse:
|
|
|
79 |
from samgis.io.wrappers_helpers import get_parsed_bbox_points_with_string_prompt
|
80 |
|
81 |
app_logger.info("starting lisa inference request...")
|
@@ -85,7 +86,8 @@ def infer_lisa(request_input: StringPromptApiRequestBody) -> JSONResponse:
|
|
85 |
|
86 |
time_start_run = time.time()
|
87 |
body_request = get_parsed_bbox_points_with_string_prompt(request_input)
|
88 |
-
app_logger.info(f"body_request:{body_request}.")
|
|
|
89 |
try:
|
90 |
output = lisa.lisa_predict(
|
91 |
bbox=body_request["bbox"], prompt=body_request["prompt"], zoom=body_request["zoom"],
|
@@ -114,6 +116,7 @@ def infer_lisa(request_input: StringPromptApiRequestBody) -> JSONResponse:
|
|
114 |
|
115 |
@app.post("/infer_samgis")
|
116 |
def infer_samgis(request_input: ApiRequestBody) -> JSONResponse:
|
|
|
117 |
from samgis.io.wrappers_helpers import get_parsed_bbox_points_with_dictlist_prompt
|
118 |
|
119 |
app_logger.info("starting samgis inference request...")
|
|
|
11 |
from samgis import PROJECT_ROOT_FOLDER
|
12 |
from samgis.utilities.type_hints import ApiRequestBody, StringPromptApiRequestBody
|
13 |
from samgis_core.utilities.fastapi_logger import setup_logging
|
|
|
14 |
|
15 |
|
16 |
app_logger = setup_logging(debug=True)
|
|
|
53 |
async def health() -> JSONResponse:
|
54 |
from samgis.__version__ import __version__ as version
|
55 |
from samgis_core.__version__ import __version__ as version_core
|
56 |
+
from lisa_on_cuda.__vesion__ import __version__ as version_lisa
|
57 |
|
58 |
+
app_logger.info(f"still alive, version:{version}, core version:{version_core}, lisa version:{version_lisa}.")
|
59 |
return JSONResponse(status_code=200, content={"msg": "still alive..."})
|
60 |
|
61 |
|
|
|
76 |
|
77 |
@app.post("/infer_lisa")
|
78 |
def infer_lisa(request_input: StringPromptApiRequestBody) -> JSONResponse:
|
79 |
+
from samgis.prediction_api import lisa
|
80 |
from samgis.io.wrappers_helpers import get_parsed_bbox_points_with_string_prompt
|
81 |
|
82 |
app_logger.info("starting lisa inference request...")
|
|
|
86 |
|
87 |
time_start_run = time.time()
|
88 |
body_request = get_parsed_bbox_points_with_string_prompt(request_input)
|
89 |
+
app_logger.info(f"lisa body_request:{body_request}.")
|
90 |
+
app_logger.info(f"lisa module:{lisa}.")
|
91 |
try:
|
92 |
output = lisa.lisa_predict(
|
93 |
bbox=body_request["bbox"], prompt=body_request["prompt"], zoom=body_request["zoom"],
|
|
|
116 |
|
117 |
@app.post("/infer_samgis")
|
118 |
def infer_samgis(request_input: ApiRequestBody) -> JSONResponse:
|
119 |
+
from samgis.prediction_api import predictors
|
120 |
from samgis.io.wrappers_helpers import get_parsed_bbox_points_with_dictlist_prompt
|
121 |
|
122 |
app_logger.info("starting samgis inference request...")
|