[feat] show link about embedded huggingspace on small devices
Browse files- README.md +13 -3
- dockerfiles/dockerfile-samgis-base +8 -2
- static/src/App.vue +2 -2
- static/src/components/PagePredictionMap.vue +8 -0
README.md
CHANGED
|
@@ -21,9 +21,19 @@ Build the docker image this way:
|
|
| 21 |
# clean any old active containers
|
| 22 |
docker stop $(docker ps -a -q); docker rm $(docker ps -a -q)
|
| 23 |
|
| 24 |
-
# build the base docker image
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
# build the image, use the tag "samgis-huggingface"
|
| 29 |
docker build . --tag example-docker-namespace/samgis-huggingface --progress=plain
|
|
|
|
| 21 |
# clean any old active containers
|
| 22 |
docker stop $(docker ps -a -q); docker rm $(docker ps -a -q)
|
| 23 |
|
| 24 |
+
# build the base docker image from the repository root folder using ARGs:
|
| 25 |
+
# - DEPENDENCY_GROUP=fastapi used by poetry
|
| 26 |
+
# VITE__MAP_DESCRIPTION, VITE__PATHNAME_CHECK, VITE__SAMGIS_SPACE used by 'docker build'
|
| 27 |
+
(
|
| 28 |
+
set -o allexport && source <(cat ./static/.env|grep VITE__) && set +o allexport;
|
| 29 |
+
env|grep VITE__;
|
| 30 |
+
docker build . -f dockerfiles/dockerfile-samgis-base --progress=plain \
|
| 31 |
+
--build-arg DEPENDENCY_GROUP=fastapi \
|
| 32 |
+
--build-arg VITE__MAP_DESCRIPTION=${VITE__MAP_DESCRIPTION} \
|
| 33 |
+
--build-arg VITE__PATHNAME_CHECK=${VITE__PATHNAME_CHECK} \
|
| 34 |
+
--build-arg VITE__SAMGIS_SPACE=${VITE__SAMGIS_SPACE} \
|
| 35 |
+
--tag registry.gitlab.com/aletrn/gis-prediction
|
| 36 |
+
)
|
| 37 |
|
| 38 |
# build the image, use the tag "samgis-huggingface"
|
| 39 |
docker build . --tag example-docker-namespace/samgis-huggingface --progress=plain
|
dockerfiles/dockerfile-samgis-base
CHANGED
|
@@ -99,11 +99,17 @@ RUN if [ "${DEPENDENCY_GROUP}" = "fastapi" ]; then if [ ! -d /appnode/node_modul
|
|
| 99 |
FROM node_fastapi AS node_build
|
| 100 |
|
| 101 |
ARG DEPENDENCY_GROUP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
RUN --mount=type=cache,id=pnpm,target=/pnpm/store if [ "${DEPENDENCY_GROUP}" = "fastapi" ]; then \
|
| 103 |
pnpm install --frozen-lockfile; else \
|
| 104 |
echo "DEPENDENCY_GROUP 2: ${DEPENDENCY_GROUP} ..."; fi
|
| 105 |
-
RUN --mount=type=cache,id=pnpm,target=/pnpm/store if [ "${DEPENDENCY_GROUP}" = "fastapi" ]; then
|
| 106 |
-
pnpm build; fi
|
| 107 |
RUN --mount=type=cache,id=pnpm,target=/pnpm/store if [ "${DEPENDENCY_GROUP}" = "fastapi" ]; then \
|
| 108 |
pnpm tailwindcss -i /appnode/src/input.css -o /appnode/dist/output.css; fi
|
| 109 |
RUN if [ "${DEPENDENCY_GROUP}" = "fastapi" ]; then if [ ! -d /appnode/dist ]; then echo "no dist folder" && exit 1; fi; fi
|
|
|
|
| 99 |
FROM node_fastapi AS node_build
|
| 100 |
|
| 101 |
ARG DEPENDENCY_GROUP
|
| 102 |
+
ARG VITE__MAP_DESCRIPTION
|
| 103 |
+
ARG VITE__PATHNAME_CHECK
|
| 104 |
+
ARG VITE__SAMGIS_SPACE
|
| 105 |
+
RUN echo "VITE__MAP_DESCRIPTION:" ${VITE__MAP_DESCRIPTION}
|
| 106 |
+
RUN echo "VITE__PATHNAME_CHECK:" ${VITE__PATHNAME_CHECK}
|
| 107 |
+
RUN echo "VITE__SAMGIS_SPACE:" ${VITE__SAMGIS_SPACE}
|
| 108 |
+
|
| 109 |
RUN --mount=type=cache,id=pnpm,target=/pnpm/store if [ "${DEPENDENCY_GROUP}" = "fastapi" ]; then \
|
| 110 |
pnpm install --frozen-lockfile; else \
|
| 111 |
echo "DEPENDENCY_GROUP 2: ${DEPENDENCY_GROUP} ..."; fi
|
| 112 |
+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store if [ "${DEPENDENCY_GROUP}" = "fastapi" ]; then pnpm build; fi
|
|
|
|
| 113 |
RUN --mount=type=cache,id=pnpm,target=/pnpm/store if [ "${DEPENDENCY_GROUP}" = "fastapi" ]; then \
|
| 114 |
pnpm tailwindcss -i /appnode/src/input.css -o /appnode/dist/output.css; fi
|
| 115 |
RUN if [ "${DEPENDENCY_GROUP}" = "fastapi" ]; then if [ ! -d /appnode/dist ]; then echo "no dist folder" && exit 1; fi; fi
|
static/src/App.vue
CHANGED
|
@@ -28,7 +28,7 @@ const mapName = ref('prediction-map')
|
|
| 28 |
const description = ref("This page displays predictions made with a machine learning model")
|
| 29 |
|
| 30 |
onMounted(() => {
|
| 31 |
-
console.log("descr:", description.value, import.meta.env.
|
| 32 |
-
description.value = import.meta.env.
|
| 33 |
})
|
| 34 |
</script>
|
|
|
|
| 28 |
const description = ref("This page displays predictions made with a machine learning model")
|
| 29 |
|
| 30 |
onMounted(() => {
|
| 31 |
+
console.log("descr:", description.value, import.meta.env.VITE__MAP_DESCRIPTION)
|
| 32 |
+
description.value = import.meta.env.VITE__MAP_DESCRIPTION ? import.meta.env.VITE__MAP_DESCRIPTION : description.value
|
| 33 |
})
|
| 34 |
</script>
|
static/src/components/PagePredictionMap.vue
CHANGED
|
@@ -5,6 +5,10 @@
|
|
| 5 |
|
| 6 |
<div class="lg:border-r lg:col-span-3">
|
| 7 |
<div id="id-map-cont" class="">
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
<p class="hidden lg:block">{{ description }}</p>
|
| 9 |
<div class="w-full md:pt-1 md:pb-1 lg:hidden portrait:xl:hidden">
|
| 10 |
<ButtonMapSendRequest
|
|
@@ -123,6 +127,9 @@ const currentBaseMapNameRef = ref("")
|
|
| 123 |
const currentMapBBoxRef = ref()
|
| 124 |
const currentZoomRef = ref()
|
| 125 |
const promptsArrayRef: Ref<Array<IPointPrompt | IRectanglePrompt>> = ref([])
|
|
|
|
|
|
|
|
|
|
| 126 |
let map: LMap
|
| 127 |
type ServiceTiles = {
|
| 128 |
[key: SourceTileType]: LTileLayer;
|
|
@@ -188,6 +195,7 @@ const getCurrentBasemap = (url: string, providersArray: ServiceTiles) => {
|
|
| 188 |
}
|
| 189 |
|
| 190 |
onMounted(async () => {
|
|
|
|
| 191 |
const osmTile = tileLayer.provider(OpenStreetMap)
|
| 192 |
let localVarSatellite: SourceTileType = import.meta.env.VITE_SATELLITE_NAME ? String(import.meta.env.VITE_SATELLITE_NAME) : Satellite
|
| 193 |
const satelliteTile = tileLayer.provider(localVarSatellite)
|
|
|
|
| 5 |
|
| 6 |
<div class="lg:border-r lg:col-span-3">
|
| 7 |
<div id="id-map-cont" class="">
|
| 8 |
+
v-if="currentPathnameRef.startsWith(pathnameCheckRef)"
|
| 9 |
+
<p
|
| 10 |
+
class="block lg:hidden"
|
| 11 |
+
>Trouble on page scrolling? Use the <a :href="embeddedSpaceRef">embedded space</a>.</p>
|
| 12 |
<p class="hidden lg:block">{{ description }}</p>
|
| 13 |
<div class="w-full md:pt-1 md:pb-1 lg:hidden portrait:xl:hidden">
|
| 14 |
<ButtonMapSendRequest
|
|
|
|
| 127 |
const currentMapBBoxRef = ref()
|
| 128 |
const currentZoomRef = ref()
|
| 129 |
const promptsArrayRef: Ref<Array<IPointPrompt | IRectanglePrompt>> = ref([])
|
| 130 |
+
const pathnameCheckRef = ref(import.meta.env.VITE__PATHNAME_CHECK || "")
|
| 131 |
+
const currentPathnameRef = ref("current-pathname-placeholder")
|
| 132 |
+
const embeddedSpaceRef = ref(import.meta.env.VITE__SAMGIS_SPACE || "")
|
| 133 |
let map: LMap
|
| 134 |
type ServiceTiles = {
|
| 135 |
[key: SourceTileType]: LTileLayer;
|
|
|
|
| 195 |
}
|
| 196 |
|
| 197 |
onMounted(async () => {
|
| 198 |
+
currentPathnameRef.value = window.location.pathname || ""
|
| 199 |
const osmTile = tileLayer.provider(OpenStreetMap)
|
| 200 |
let localVarSatellite: SourceTileType = import.meta.env.VITE_SATELLITE_NAME ? String(import.meta.env.VITE_SATELLITE_NAME) : Satellite
|
| 201 |
const satelliteTile = tileLayer.provider(localVarSatellite)
|