alessandro trinca tornidor
commited on
Commit
·
d77c086
1
Parent(s):
cd9b522
feat: update /static frontend folder
Browse files- static/README.md +18 -27
- static/index.html +1 -0
- static/lisa.html +1 -0
- static/package.json +2 -1
- static/public/apple-touch-icon.png +0 -0
- static/public/icon-192.png +0 -0
- static/public/icon-512.png +0 -0
- static/public/marker-icon-exclude-2x.png +0 -0
- static/public/marker-icon-exclude.png +0 -0
- static/public/marker-icon-include-2x.png +0 -0
- static/public/marker-icon-include.png +0 -0
- static/public/marker-shadow.png +0 -0
- tests/io/__init__.py → static/resources/.gitignore +0 -0
- static/resources/imgs/blackpink.jpg +3 -0
- static/resources/imgs/car_speed.jpg +3 -0
- static/resources/imgs/dog_with_horn.jpg +3 -0
- static/resources/imgs/example1.jpg +3 -0
- static/resources/imgs/example2.jpg +3 -0
- static/resources/imgs/example3.jpg +3 -0
- static/resources/imgs/fig_overview.jpg +3 -0
- static/resources/imgs/jackma.jpg +3 -0
- static/resources/imgs/obama.jpg +3 -0
- static/resources/imgs/stand_higher.jpg +3 -0
- static/resources/imgs/table1.jpg +3 -0
- static/resources/imgs/trump.jpg +3 -0
- static/resources/placeholders/error_happened.png +3 -0
- static/resources/placeholders/no_seg_out.png +3 -0
- static/samgis.html +1 -0
- static/src/AppLisa.vue +6 -4
- static/src/AppSamgis.vue +5 -2
- static/src/components/PageLisaMap.vue +1 -1
- static/vite.config.ts +24 -21
static/README.md
CHANGED
@@ -1,36 +1,27 @@
|
|
1 |
-
#
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
-
2. run the local environment using the command `pnpm dev` or `deno run -A runner.js`
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
|
13 |
-
deno run -A --node-modules-dir npm:vite
|
14 |
-
```
|
15 |
|
16 |
-
|
|
|
|
|
17 |
|
18 |
-
|
19 |
|
20 |
-
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
3. Run again the local development server, this time with the standard command
|
25 |
-
|
26 |
-
Before to commit try also to build using
|
27 |
-
|
28 |
-
```bash
|
29 |
-
pnpm build
|
30 |
-
```
|
31 |
-
|
32 |
-
Then run the preview (change the example variables):
|
33 |
-
|
34 |
-
```bash
|
35 |
-
npx wrangler pages dev --binding VITE_AUTH0_DOMAIN="example-auth0.eu.auth0.com" API_URL="https://example-aws.execute-api.eu-west-1.amazonaws.com/localhost/lambda-ml-fastsam-api" VITE_AUTH0_AUDIENCE="http://localhost-ml-lambda/" API_DOMAIN=example-aws.execute-api.eu-west-1.amazonaws.com CORS_ALLOWED_DOMAIN=http://localhost:8788 VITE_SATELLITE_NAME="tile-provider.image-type" -- pnpm preview
|
36 |
-
```
|
|
|
1 |
+
# SamGIS+LISA+ZeroGPU!
|
2 |
|
3 |
+
[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).
|
4 |
|
5 |
+
I also adapted LISA to HuggingFace [lisa-on-cuda](https://huggingface.co/spaces/aletrn/lisa-on-cuda) ZeroGPU space.
|
6 |
|
7 |
+
## projects I based this work on
|
|
|
8 |
|
9 |
+
- [LISA](https://github.com/dvlab-research/LISA)
|
10 |
+
- [Segment Anything](https://segment-anything.com)
|
11 |
+
- [ONNX Runtime](https://onnxruntime.ai/)
|
12 |
+
- [transformers](https://github.com/huggingface/transformers)
|
13 |
+
- [Vue](https://vuejs.org)
|
14 |
+
- [leaflet](https://leafletjs.com/)
|
15 |
|
16 |
+
My previous projects I reused:
|
|
|
|
|
17 |
|
18 |
+
- [SamGIS+LISA (regular GPU) huggingface space](https://huggingface.co/spaces/aletrn/samgis-lisa-on-cuda), [SamGIS+LISA blog page](https://trinca.tornidor.com/projects/lisa-adapted-for-samgis)
|
19 |
+
- [lisa-on-cuda huggingface space](https://huggingface.co/spaces/aletrn/samgis-lisa-on-cuda)
|
20 |
+
- [transformers-backport repository](https://github.com/trincadev/transformers_backport), [transformers pip package](https://snyk.io/advisor/python/transformers-backport)
|
21 |
|
22 |
+
# Build the frontend
|
23 |
|
24 |
+
Check the package.json for the custom commands, in particular:
|
25 |
|
26 |
+
- `build:tailwindcss`
|
27 |
+
- `build`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static/index.html
CHANGED
@@ -5,6 +5,7 @@
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<link href="output.css" rel="stylesheet" type="text/css">
|
7 |
<link href="dist/output.css" rel="stylesheet" type="text/css">
|
|
|
8 |
<link rel="icon" href="/favicon.ico" sizes="32x32">
|
9 |
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
10 |
<link rel="apple-touch-icon" href="/apple-touch-icon.png"><!-- 180×180 -->
|
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<link href="output.css" rel="stylesheet" type="text/css">
|
7 |
<link href="dist/output.css" rel="stylesheet" type="text/css">
|
8 |
+
<link href="static/output.css" rel="stylesheet" type="text/css">
|
9 |
<link rel="icon" href="/favicon.ico" sizes="32x32">
|
10 |
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
11 |
<link rel="apple-touch-icon" href="/apple-touch-icon.png"><!-- 180×180 -->
|
static/lisa.html
CHANGED
@@ -5,6 +5,7 @@
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<link href="output.css" rel="stylesheet" type="text/css">
|
7 |
<link href="dist/output.css" rel="stylesheet" type="text/css">
|
|
|
8 |
<link rel="icon" href="/favicon.ico" sizes="32x32">
|
9 |
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
10 |
<link rel="apple-touch-icon" href="/apple-touch-icon.png"><!-- 180×180 -->
|
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<link href="output.css" rel="stylesheet" type="text/css">
|
7 |
<link href="dist/output.css" rel="stylesheet" type="text/css">
|
8 |
+
<link href="static/output.css" rel="stylesheet" type="text/css">
|
9 |
<link rel="icon" href="/favicon.ico" sizes="32x32">
|
10 |
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
11 |
<link rel="apple-touch-icon" href="/apple-touch-icon.png"><!-- 180×180 -->
|
static/package.json
CHANGED
@@ -5,7 +5,8 @@
|
|
5 |
"dev": "vite",
|
6 |
"build": "vite build",
|
7 |
"preview": "vite preview --port 5173",
|
8 |
-
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
|
|
|
9 |
},
|
10 |
"type": "module",
|
11 |
"dependencies": {
|
|
|
5 |
"dev": "vite",
|
6 |
"build": "vite build",
|
7 |
"preview": "vite preview --port 5173",
|
8 |
+
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore",
|
9 |
+
"build:tailwindcss": "pnpm tailwindcss -i src/input.css -o dist/output.css"
|
10 |
},
|
11 |
"type": "module",
|
12 |
"dependencies": {
|
static/public/apple-touch-icon.png
CHANGED
Git LFS Details
|
static/public/icon-192.png
CHANGED
Git LFS Details
|
static/public/icon-512.png
CHANGED
Git LFS Details
|
static/public/marker-icon-exclude-2x.png
CHANGED
Git LFS Details
|
static/public/marker-icon-exclude.png
CHANGED
Git LFS Details
|
static/public/marker-icon-include-2x.png
CHANGED
Git LFS Details
|
static/public/marker-icon-include.png
CHANGED
Git LFS Details
|
static/public/marker-shadow.png
CHANGED
Git LFS Details
|
tests/io/__init__.py → static/resources/.gitignore
RENAMED
File without changes
|
static/resources/imgs/blackpink.jpg
ADDED
Git LFS Details
|
static/resources/imgs/car_speed.jpg
ADDED
Git LFS Details
|
static/resources/imgs/dog_with_horn.jpg
ADDED
Git LFS Details
|
static/resources/imgs/example1.jpg
ADDED
Git LFS Details
|
static/resources/imgs/example2.jpg
ADDED
Git LFS Details
|
static/resources/imgs/example3.jpg
ADDED
Git LFS Details
|
static/resources/imgs/fig_overview.jpg
ADDED
Git LFS Details
|
static/resources/imgs/jackma.jpg
ADDED
Git LFS Details
|
static/resources/imgs/obama.jpg
ADDED
Git LFS Details
|
static/resources/imgs/stand_higher.jpg
ADDED
Git LFS Details
|
static/resources/imgs/table1.jpg
ADDED
Git LFS Details
|
static/resources/imgs/trump.jpg
ADDED
Git LFS Details
|
static/resources/placeholders/error_happened.png
ADDED
Git LFS Details
|
static/resources/placeholders/no_seg_out.png
ADDED
Git LFS Details
|
static/samgis.html
CHANGED
@@ -5,6 +5,7 @@
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<link href="output.css" rel="stylesheet" type="text/css">
|
7 |
<link href="dist/output.css" rel="stylesheet" type="text/css">
|
|
|
8 |
<link rel="icon" href="/favicon.ico" sizes="32x32">
|
9 |
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
10 |
<link rel="apple-touch-icon" href="/apple-touch-icon.png"><!-- 180×180 -->
|
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<link href="output.css" rel="stylesheet" type="text/css">
|
7 |
<link href="dist/output.css" rel="stylesheet" type="text/css">
|
8 |
+
<link href="static/output.css" rel="stylesheet" type="text/css">
|
9 |
<link rel="icon" href="/favicon.ico" sizes="32x32">
|
10 |
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
11 |
<link rel="apple-touch-icon" href="/apple-touch-icon.png"><!-- 180×180 -->
|
static/src/AppLisa.vue
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<template>
|
2 |
<PageLayout
|
3 |
-
aboutThisDescription="LISA adapted to SamGIS"
|
4 |
aboutThisUrl="https://trinca.tornidor.com/projects/lisa-adapted-for-samgis"
|
5 |
currentPageUrl="https://aletrn-samgis-lisa-on-cuda.hf.space"
|
6 |
-
pageTitle="LISA+
|
7 |
-
switchTabDescription="SamGIS demo"
|
8 |
-
switchTabUrl=
|
9 |
>
|
10 |
<div>
|
11 |
<div id="map-container-md-lisa">
|
@@ -26,6 +26,8 @@ import { ref } from 'vue'
|
|
26 |
import PageLisaMap from '@/components/PageLisaMap.vue'
|
27 |
import PageLayout from '@/components/PageLayout.vue'
|
28 |
|
|
|
|
|
29 |
const mapName = ref('lisa-map')
|
30 |
const description = ref("This page displays predictions made with LISA VLM.")
|
31 |
</script>
|
|
|
1 |
<template>
|
2 |
<PageLayout
|
3 |
+
aboutThisDescription="LISA adapted to SamGIS on CUDA"
|
4 |
aboutThisUrl="https://trinca.tornidor.com/projects/lisa-adapted-for-samgis"
|
5 |
currentPageUrl="https://aletrn-samgis-lisa-on-cuda.hf.space"
|
6 |
+
pageTitle="SamGIS+LISA+CUDA"
|
7 |
+
switchTabDescription="SamGIS on CUDA demo"
|
8 |
+
:switchTabUrl=switchTabUrlRef
|
9 |
>
|
10 |
<div>
|
11 |
<div id="map-container-md-lisa">
|
|
|
26 |
import PageLisaMap from '@/components/PageLisaMap.vue'
|
27 |
import PageLayout from '@/components/PageLayout.vue'
|
28 |
|
29 |
+
const switchTabUrl = import.meta.env.VITE_SAMGIS_URL ? import.meta.env.VITE_SAMGIS_URL : "/samgis"
|
30 |
+
const switchTabUrlRef = ref(switchTabUrl)
|
31 |
const mapName = ref('lisa-map')
|
32 |
const description = ref("This page displays predictions made with LISA VLM.")
|
33 |
</script>
|
static/src/AppSamgis.vue
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
aboutThisUrl="https://trinca.tornidor.com/projects/samgis-segment-anything-applied-to-GIS"
|
5 |
currentPageUrl="https://aletrn-samgis-lisa-on-cuda.hf.space/samgis"
|
6 |
pageTitle="SamGIS demo"
|
7 |
-
switchTabDescription="LISA+SamGIS demo"
|
8 |
-
switchTabUrl="
|
9 |
>
|
10 |
<div>
|
11 |
<div id="map-container-md-main">
|
@@ -31,11 +31,14 @@ import { onMounted, ref } from 'vue'
|
|
31 |
import PredictionMap from '@/components/PagePredictionMap.vue'
|
32 |
import PageLayout from '@/components/PageLayout.vue'
|
33 |
|
|
|
|
|
34 |
const mapName = ref('prediction-map')
|
35 |
const description = ref("This page displays predictions made with a machine learning model")
|
36 |
|
37 |
onMounted(() => {
|
38 |
console.log("descr:", description.value, import.meta.env.VITE__MAP_DESCRIPTION)
|
|
|
39 |
description.value = import.meta.env.VITE__MAP_DESCRIPTION ? import.meta.env.VITE__MAP_DESCRIPTION : description.value
|
40 |
})
|
41 |
</script>
|
|
|
4 |
aboutThisUrl="https://trinca.tornidor.com/projects/samgis-segment-anything-applied-to-GIS"
|
5 |
currentPageUrl="https://aletrn-samgis-lisa-on-cuda.hf.space/samgis"
|
6 |
pageTitle="SamGIS demo"
|
7 |
+
switchTabDescription="LISA+SamGIS+CUDA demo"
|
8 |
+
:switchTabUrl="switchTabUrlRef"
|
9 |
>
|
10 |
<div>
|
11 |
<div id="map-container-md-main">
|
|
|
31 |
import PredictionMap from '@/components/PagePredictionMap.vue'
|
32 |
import PageLayout from '@/components/PageLayout.vue'
|
33 |
|
34 |
+
const switchTabUrl = import.meta.env.VITE_LISA_URL ? import.meta.env.VITE_LISA_URL : "/"
|
35 |
+
const switchTabUrlRef = ref(switchTabUrl)
|
36 |
const mapName = ref('prediction-map')
|
37 |
const description = ref("This page displays predictions made with a machine learning model")
|
38 |
|
39 |
onMounted(() => {
|
40 |
console.log("descr:", description.value, import.meta.env.VITE__MAP_DESCRIPTION)
|
41 |
+
console.log("switchTabUrl:", switchTabUrl, ", urls from env:", import.meta.env.VITE_SAMGIS_URL, import.meta.env.VITE_LISA_URL, "#")
|
42 |
description.value = import.meta.env.VITE__MAP_DESCRIPTION ? import.meta.env.VITE__MAP_DESCRIPTION : description.value
|
43 |
})
|
44 |
</script>
|
static/src/components/PageLisaMap.vue
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
<div class="lg:border-r lg:col-span-3">
|
7 |
<div id="id-map-cont" class="">
|
8 |
<div class="flex">
|
9 |
-
<span class="flex portrait:hidden bg-slate-200">LISA+SamGIS demo</span>
|
10 |
<span class="ml-2">
|
11 |
<input type="checkbox" id="checkboxMapNavigationLocked" v-model="mapNavigationLocked" />
|
12 |
<span class="ml-2">
|
|
|
6 |
<div class="lg:border-r lg:col-span-3">
|
7 |
<div id="id-map-cont" class="">
|
8 |
<div class="flex">
|
9 |
+
<span class="flex portrait:hidden bg-slate-200">LISA+SamGIS+ZeroGPU demo</span>
|
10 |
<span class="ml-2">
|
11 |
<input type="checkbox" id="checkboxMapNavigationLocked" v-model="mapNavigationLocked" />
|
12 |
<span class="ml-2">
|
static/vite.config.ts
CHANGED
@@ -1,26 +1,29 @@
|
|
1 |
-
import {
|
2 |
-
import {
|
3 |
-
|
4 |
-
import { defineConfig } from 'vite'
|
5 |
import vue from '@vitejs/plugin-vue'
|
6 |
|
7 |
// https://vitejs.dev/config/
|
8 |
-
export default defineConfig({
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
}
|
16 |
-
},
|
17 |
-
build: {
|
18 |
-
rollupOptions: {
|
19 |
-
input: {
|
20 |
-
samgis: resolve(__dirname, 'samgis.html'),
|
21 |
-
lisa: resolve(__dirname, 'lisa.html'),
|
22 |
-
index: resolve(__dirname, "index.html"),
|
23 |
-
},
|
24 |
-
},
|
25 |
-
},
|
26 |
})
|
|
|
1 |
+
import {fileURLToPath, URL} from 'node:url'
|
2 |
+
import {resolve} from 'node:path'
|
3 |
+
import {defineConfig, loadEnv} from 'vite'
|
|
|
4 |
import vue from '@vitejs/plugin-vue'
|
5 |
|
6 |
// https://vitejs.dev/config/
|
7 |
+
export default defineConfig(({mode}) => {
|
8 |
+
const env = loadEnv(mode, process.cwd())
|
9 |
+
const frontendPrefix = env.VITE_INDEX_URL ? env.VITE_INDEX_URL : "/"
|
10 |
+
console.log(`VITE_PREFIX:${env.VITE_INDEX_URL}, frontend_prefix:${frontendPrefix}, mode:${mode} ...`)
|
11 |
+
return {
|
12 |
+
plugins: [vue()],
|
13 |
+
base: frontendPrefix,
|
14 |
+
resolve: {
|
15 |
+
alias: {
|
16 |
+
'@': fileURLToPath(new URL('./src', import.meta.url))
|
17 |
+
}
|
18 |
+
},
|
19 |
+
build: {
|
20 |
+
rollupOptions: {
|
21 |
+
input: {
|
22 |
+
samgis: resolve(__dirname, 'samgis.html'),
|
23 |
+
lisa: resolve(__dirname, 'lisa.html'),
|
24 |
+
index: resolve(__dirname, "index.html"),
|
25 |
+
},
|
26 |
+
},
|
27 |
+
}
|
28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
})
|