Spaces:
Running
Running
alessandro trinca tornidor
feat: first attempt to support samgis-lisa-on-cuda on ZeroGPU huggingface space
8783164
"""Get machine learning predictions from geodata raster images""" | |
import os | |
# not used here but contextily_tile is imported in samgis_lisa_on_zero.io.tms2geotiff | |
from contextily import tile as contextily_tile | |
from pathlib import Path | |
from samgis_lisa_on_zero.utilities.constants import SERVICE_NAME | |
ROOT = Path(globals().get("__file__", "./_")).absolute().parent.parent | |
PROJECT_ROOT_FOLDER = Path(os.getenv("PROJECT_ROOT_FOLDER", ROOT)) | |
WORKDIR = Path(os.getenv("WORKDIR", ROOT)) | |
MODEL_FOLDER_PROJECT_ROOT_FOLDER = Path(PROJECT_ROOT_FOLDER / "machine_learning_models") | |
MODEL_FOLDER = Path(os.getenv("MODEL_FOLDER", MODEL_FOLDER_PROJECT_ROOT_FOLDER)) | |
IS_AWS_LAMBDA = bool(os.getenv("IS_AWS_LAMBDA", "")) | |
if IS_AWS_LAMBDA: | |
try: | |
from aws_lambda_powertools import Logger | |
app_logger = Logger(service=SERVICE_NAME) | |
except ModuleNotFoundError: | |
print("this should be AWS LAMBDA environment but we miss the required aws lambda powertools package") | |
else: | |
from samgis_core.utilities.fastapi_logger import setup_logging | |
app_logger = setup_logging(debug=True) | |