File size: 1,990 Bytes
b00385f cff759e 0914710 b00385f 8783164 0914710 b00385f 8783164 9bee93c cff759e 66a0f19 cff759e 0c9e62a 8783164 0914710 cff759e 66a0f19 cff759e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
---
title: SamGIS - LISA on ZeroGPU
emoji: 🗺️
colorFrom: red
colorTo: blue
sdk: gradio
sdk_version: 4.37.2
app_file: app.py
pinned: true
license: mit
---
# [LISA](https://github.com/dvlab-research/LISA) + [SamGIS](https://github.com/trincadev/samgis-be) on Zero GPU!
[LISA](https://github.com/dvlab-research/LISA) (Reasoning Segmentation via Large Language Model) applied to geospatial data thanks to [SamGIS](https://github.com/trincadev/samgis-be).
I also adapted LISA to HuggingFace [lisa-on-cuda](https://huggingface.co/spaces/aletrn/lisa-on-cuda) ZeroGPU space.
## Custom environment variables for HuggingFace ZeroGPU Space
Fundamental environment variables you need are:
```bash
XDG_CACHE_HOME="/data/.cache"
PROJECT_ROOT_FOLDER="/home/user/app"
WORKDIR="/home/user/app"
```
Derived ones:
```bash
MPLCONFIGDIR="/data/.cache/matplotlib"
TRANSFORMERS_CACHE="/data/.cache/transformers"
PYTORCH_KERNEL_CACHE_PATH="/data/.cache/torch/kernels"
FASTAPI_STATIC="/home/user/app/static"
VIS_OUTPUT="/home/user/app/vis_output"
MODEL_FOLDER="/home/user/app/machine_learning_models"
FOLDERS_MAP='{"WORKDIR":"/home/user/app","XDG_CACHE_HOME":"/data/.cache","PROJECT_ROOT_FOLDER":"/home/user/app","MPLCONFIGDIR":"/data/.cache/matplotlib","TRANSFORMERS_CACHE":"/data/.cache/transformers","PYTORCH_KERNEL_CACHE_PATH":"/data/.cache/torch/kernels","FASTAPI_STATIC":"/home/user/app/static","VIS_OUTPUT":"/home/user/app/vis_output"}'
```
The function `build_frontend()` from lisa_on_cuda package create all the folders required for this project using the environment variable `FOLDERS_MAP`. That's useful for cache folders (XDG_CACHE_HOME, MPLCONFIGDIR, TRANSFORMERS_CACHE, PYTORCH_KERNEL_CACHE_PATH) because missing these can slow down the inference process. Also you could keep these folders in a permanent storage disk mounted on a custom path.
To change the base relative url for custom frontend add the VITE_PREFIX environment variable, e.g.:
```bash
VITE_INDEX_URL="/custom-url"
```
|