Spaces:
Build error
Build error
Kelbec
commited on
Commit
•
c1a444d
1
Parent(s):
4bc2361
downloadable file
Browse files- Dockerfile +1 -1
- docker-compose.yml +4 -2
- pages/01_dcascade.py +17 -8
Dockerfile
CHANGED
@@ -26,4 +26,4 @@ USER ${NB_USER}
|
|
26 |
RUN mkdir ./public
|
27 |
EXPOSE 8765
|
28 |
|
29 |
-
CMD ["solara", "run", "./pages", "--host=0.0.0.0"]
|
|
|
26 |
RUN mkdir ./public
|
27 |
EXPOSE 8765
|
28 |
|
29 |
+
CMD ["solara", "run", "./pages", "--host=0.0.0.0", "--production"]
|
docker-compose.yml
CHANGED
@@ -2,8 +2,10 @@
|
|
2 |
# docker-compose up -d
|
3 |
services:
|
4 |
dcascade:
|
5 |
-
image:
|
6 |
ports:
|
7 |
- "8765:8765"
|
8 |
volumes:
|
9 |
-
- ./public:/home/jovyan/public
|
|
|
|
|
|
2 |
# docker-compose up -d
|
3 |
services:
|
4 |
dcascade:
|
5 |
+
image: dcascade-app:latest
|
6 |
ports:
|
7 |
- "8765:8765"
|
8 |
volumes:
|
9 |
+
- ./public:/home/jovyan/public
|
10 |
+
environment:
|
11 |
+
- SOLARA_HOST=localhost
|
pages/01_dcascade.py
CHANGED
@@ -1,20 +1,17 @@
|
|
1 |
import os
|
2 |
from pathlib import Path
|
3 |
import shutil
|
4 |
-
from typing import
|
5 |
-
import
|
6 |
-
# import leafmap
|
7 |
-
from ipyleaflet import Map, GeoData, basemaps, LayersControl, ScaleControl, FullScreenControl, WidgetControl, TileLayer, Marker
|
8 |
import geopandas as gpd
|
9 |
import solara
|
10 |
-
from solara import FigureEcharts
|
11 |
-
from leafmap.toolbar import change_basemap
|
12 |
from solara.components.file_drop import FileInfo
|
13 |
from dcascade_py import dcascade_py
|
14 |
import xarray as xr
|
15 |
from shapely.geometry import LineString,MultiLineString
|
16 |
import time
|
17 |
-
|
18 |
|
19 |
file_nc = solara.reactive("")
|
20 |
file_shp = solara.reactive("")
|
@@ -51,6 +48,14 @@ maps = {
|
|
51 |
map_name = solara.reactive(list(maps)[0])
|
52 |
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
def on_variable_change(variable):
|
55 |
print("feature",feature_properties.value)
|
56 |
sel_var.set(variable)
|
@@ -196,7 +201,11 @@ def MapComponent():
|
|
196 |
global_map_loaded.set(True)
|
197 |
solara.Select(label="Variable", value=sel_var, values=variables.value, on_value=on_variable_change)
|
198 |
FigureEcharts(option=chart_options.value["line"])
|
199 |
-
|
|
|
|
|
|
|
|
|
200 |
|
201 |
|
202 |
@solara.component
|
|
|
1 |
import os
|
2 |
from pathlib import Path
|
3 |
import shutil
|
4 |
+
from typing import Optional, cast
|
5 |
+
from ipyleaflet import Map, GeoData, basemaps, LayersControl, TileLayer
|
|
|
|
|
6 |
import geopandas as gpd
|
7 |
import solara
|
8 |
+
from solara import FigureEcharts
|
|
|
9 |
from solara.components.file_drop import FileInfo
|
10 |
from dcascade_py import dcascade_py
|
11 |
import xarray as xr
|
12 |
from shapely.geometry import LineString,MultiLineString
|
13 |
import time
|
14 |
+
import shutil
|
15 |
|
16 |
file_nc = solara.reactive("")
|
17 |
file_shp = solara.reactive("")
|
|
|
48 |
map_name = solara.reactive(list(maps)[0])
|
49 |
|
50 |
|
51 |
+
def create_data_archive():
|
52 |
+
|
53 |
+
# Specify the folder path to be zipped
|
54 |
+
folder_to_zip = file_shp.value.split("/deposito")[-2]
|
55 |
+
# Zip the folder
|
56 |
+
shutil.make_archive(folder_to_zip,'zip',f"{os.getcwd()}/public/data/",os.path.basename(folder_to_zip))
|
57 |
+
|
58 |
+
|
59 |
def on_variable_change(variable):
|
60 |
print("feature",feature_properties.value)
|
61 |
sel_var.set(variable)
|
|
|
201 |
global_map_loaded.set(True)
|
202 |
solara.Select(label="Variable", value=sel_var, values=variables.value, on_value=on_variable_change)
|
203 |
FigureEcharts(option=chart_options.value["line"])
|
204 |
+
|
205 |
+
create_data_archive()
|
206 |
+
print(os.environ["SOLARA_HOST"])
|
207 |
+
solara.Markdown(f"[**Click here to download output files**](http://{os.environ['SOLARA_HOST']}:8765/static/public/data/{file_shp.value.split('/deposito')[-2].split('/')[-1]}.zip)")
|
208 |
+
# solara.Markdown(f'<a href=http://localhost:8765/static/public/data/{file_shp.value.split("/deposito")[-2].split("/")[-1]}.zip target="_blank">Download file</a>')
|
209 |
|
210 |
|
211 |
@solara.component
|