Spaces:
Sleeping
Sleeping
AbhiSinghRathore
commited on
Commit
•
451ef07
1
Parent(s):
f9d05bf
new codes
Browse files- .gitignore +131 -0
- LICENSE +21 -0
- Procfile +1 -0
- README.md +9 -12
- home.py +26 -0
- index.html +40 -0
- packages.txt +6 -0
- postBuild +6 -0
- req_old.txt +9 -0
- requirements.txt +26 -0
- setup.sh +18 -0
- streamlit-template.code-workspace +13 -0
.gitignore
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Byte-compiled / optimized / DLL files
|
2 |
+
__pycache__/
|
3 |
+
*.py[cod]
|
4 |
+
*$py.class
|
5 |
+
private/
|
6 |
+
.vscode/
|
7 |
+
|
8 |
+
# C extensions
|
9 |
+
*.so
|
10 |
+
|
11 |
+
# Distribution / packaging
|
12 |
+
.Python
|
13 |
+
build/
|
14 |
+
develop-eggs/
|
15 |
+
dist/
|
16 |
+
downloads/
|
17 |
+
eggs/
|
18 |
+
.eggs/
|
19 |
+
lib/
|
20 |
+
lib64/
|
21 |
+
parts/
|
22 |
+
sdist/
|
23 |
+
var/
|
24 |
+
wheels/
|
25 |
+
pip-wheel-metadata/
|
26 |
+
share/python-wheels/
|
27 |
+
*.egg-info/
|
28 |
+
.installed.cfg
|
29 |
+
*.egg
|
30 |
+
MANIFEST
|
31 |
+
|
32 |
+
# PyInstaller
|
33 |
+
# Usually these files are written by a python script from a template
|
34 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
35 |
+
*.manifest
|
36 |
+
*.spec
|
37 |
+
|
38 |
+
# Installer logs
|
39 |
+
pip-log.txt
|
40 |
+
pip-delete-this-directory.txt
|
41 |
+
|
42 |
+
# Unit test / coverage reports
|
43 |
+
htmlcov/
|
44 |
+
.tox/
|
45 |
+
.nox/
|
46 |
+
.coverage
|
47 |
+
.coverage.*
|
48 |
+
.cache
|
49 |
+
nosetests.xml
|
50 |
+
coverage.xml
|
51 |
+
*.cover
|
52 |
+
*.py,cover
|
53 |
+
.hypothesis/
|
54 |
+
.pytest_cache/
|
55 |
+
|
56 |
+
# Translations
|
57 |
+
*.mo
|
58 |
+
*.pot
|
59 |
+
|
60 |
+
# Django stuff:
|
61 |
+
*.log
|
62 |
+
local_settings.py
|
63 |
+
db.sqlite3
|
64 |
+
db.sqlite3-journal
|
65 |
+
|
66 |
+
# Flask stuff:
|
67 |
+
instance/
|
68 |
+
.webassets-cache
|
69 |
+
|
70 |
+
# Scrapy stuff:
|
71 |
+
.scrapy
|
72 |
+
|
73 |
+
# Sphinx documentation
|
74 |
+
docs/_build/
|
75 |
+
|
76 |
+
# PyBuilder
|
77 |
+
target/
|
78 |
+
|
79 |
+
# Jupyter Notebook
|
80 |
+
.ipynb_checkpoints
|
81 |
+
|
82 |
+
# IPython
|
83 |
+
profile_default/
|
84 |
+
ipython_config.py
|
85 |
+
|
86 |
+
# pyenv
|
87 |
+
.python-version
|
88 |
+
|
89 |
+
# pipenv
|
90 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
91 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
92 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
93 |
+
# install all needed dependencies.
|
94 |
+
#Pipfile.lock
|
95 |
+
|
96 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
97 |
+
__pypackages__/
|
98 |
+
|
99 |
+
# Celery stuff
|
100 |
+
celerybeat-schedule
|
101 |
+
celerybeat.pid
|
102 |
+
|
103 |
+
# SageMath parsed files
|
104 |
+
*.sage.py
|
105 |
+
|
106 |
+
# Environments
|
107 |
+
.env
|
108 |
+
.venv
|
109 |
+
env/
|
110 |
+
venv/
|
111 |
+
ENV/
|
112 |
+
env.bak/
|
113 |
+
venv.bak/
|
114 |
+
|
115 |
+
# Spyder project settings
|
116 |
+
.spyderproject
|
117 |
+
.spyproject
|
118 |
+
|
119 |
+
# Rope project settings
|
120 |
+
.ropeproject
|
121 |
+
|
122 |
+
# mkdocs documentation
|
123 |
+
/site
|
124 |
+
|
125 |
+
# mypy
|
126 |
+
.mypy_cache/
|
127 |
+
.dmypy.json
|
128 |
+
dmypy.json
|
129 |
+
|
130 |
+
# Pyre type checker
|
131 |
+
.pyre/
|
LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2022 Qiusheng Wu
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
Procfile
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
web: sh setup.sh && streamlit run streamlit_app.py
|
README.md
CHANGED
@@ -1,12 +1,9 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
+
# streamlit-template
|
2 |
+
|
3 |
+
A streamlit app template for geospatial applications based on [streamlit-option-menu](https://github.com/victoryhb/streamlit-option-menu).
|
4 |
+
|
5 |
+
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/giswqs/streamlit-template/master?urlpath=proxy/8501/)
|
6 |
+
|
7 |
+
App URL: <https://share.streamlit.io/giswqs/streamlit-template>
|
8 |
+
|
9 |
+
![](https://i.imgur.com/xd64mCi.png)
|
|
|
|
|
|
home.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import leafmap.foliumap as leafmap
|
3 |
+
import os
|
4 |
+
|
5 |
+
st.title("Project Canopy 🌲")
|
6 |
+
|
7 |
+
st.markdown(
|
8 |
+
"""
|
9 |
+
Project Canopy allows you to select any area of your choice and produces a comprehensive deforestation report on it.
|
10 |
+
Check out https://www.projectcanopy.org/ for more details.
|
11 |
+
|
12 |
+
"""
|
13 |
+
)
|
14 |
+
# [21.920471,-0.556174]
|
15 |
+
m = leafmap.Map(locate_control=True)
|
16 |
+
m.add_basemap("ROADMAP")
|
17 |
+
m = leafmap.Map(center=[21.920471, -0.556174], zoom=2)
|
18 |
+
|
19 |
+
input_mask_folder = "output"
|
20 |
+
dir_values = os.listdir(input_mask_folder)
|
21 |
+
for i in range(len(dir_values)):
|
22 |
+
if dir_values[i].endswith(".geojson"):
|
23 |
+
in_geojson = "output/" + dir_values[i]
|
24 |
+
m.add_geojson(in_geojson, layer_name=dir_values[i])
|
25 |
+
|
26 |
+
m.to_streamlit(height=700)
|
index.html
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
<title>Streamlit Web App</title>
|
5 |
+
<style type="text/css">
|
6 |
+
html {
|
7 |
+
overflow: auto;
|
8 |
+
}
|
9 |
+
html,
|
10 |
+
body,
|
11 |
+
div,
|
12 |
+
iframe {
|
13 |
+
margin: 0px;
|
14 |
+
padding: 0px;
|
15 |
+
height: 100%;
|
16 |
+
border: none;
|
17 |
+
}
|
18 |
+
iframe {
|
19 |
+
display: block;
|
20 |
+
width: 100%;
|
21 |
+
border: none;
|
22 |
+
overflow-y: auto;
|
23 |
+
overflow-x: hidden;
|
24 |
+
}
|
25 |
+
</style>
|
26 |
+
</head>
|
27 |
+
<body>
|
28 |
+
<iframe
|
29 |
+
src="https://share.streamlit.io/giswqs/streamlit-template"
|
30 |
+
frameborder="0"
|
31 |
+
marginheight="0"
|
32 |
+
marginwidth="0"
|
33 |
+
width="100%"
|
34 |
+
height="100%"
|
35 |
+
scrolling="auto"
|
36 |
+
allow="geolocation"
|
37 |
+
>
|
38 |
+
</iframe>
|
39 |
+
</body>
|
40 |
+
</html>
|
packages.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
ffmpeg
|
2 |
+
gifsicle
|
3 |
+
build-essential
|
4 |
+
python3-dev
|
5 |
+
gdal-bin
|
6 |
+
libgdal-dev
|
postBuild
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# enable nbserverproxy
|
2 |
+
jupyter serverextension enable --sys-prefix nbserverproxy
|
3 |
+
# streamlit launches at startup
|
4 |
+
mv streamlit_call.py ${NB_PYTHON_PREFIX}/lib/python*/site-packages/
|
5 |
+
# enable streamlit extension
|
6 |
+
jupyter serverextension enable --sys-prefix streamlit_call
|
req_old.txt
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
geemap
|
2 |
+
geopandas
|
3 |
+
jupyter-server-proxy
|
4 |
+
keplergl
|
5 |
+
leafmap
|
6 |
+
localtileserver
|
7 |
+
nbserverproxy
|
8 |
+
streamlit
|
9 |
+
streamlit-option-menu
|
requirements.txt
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This file may be used to create an environment using:
|
2 |
+
# $ conda create --name <env> --file <this file>
|
3 |
+
# platform: win-64
|
4 |
+
|
5 |
+
# final
|
6 |
+
streamlit-option-menu==0.3.6
|
7 |
+
streamlit==1.27.2
|
8 |
+
streamlit-folium==0.15.1
|
9 |
+
nbconvert==7.9.2
|
10 |
+
nbformat==5.9.2
|
11 |
+
nbserverproxy==0.8.8
|
12 |
+
localtileserver==0.7.2
|
13 |
+
jupyter-server==2.8.0
|
14 |
+
jupyter-server-proxy==4.1.0
|
15 |
+
jupyter-server-terminals==0.4.4
|
16 |
+
jupyterlab==4.0.7
|
17 |
+
jupyterlab-pygments==0.2.2
|
18 |
+
jupyterlab-server==2.25.0
|
19 |
+
jupyterlab-widgets==1.1.7
|
20 |
+
keplergl==0.3.2
|
21 |
+
leafmap==0.27.1
|
22 |
+
gdown==4.7.1
|
23 |
+
geemap==0.29.1
|
24 |
+
geocoder==1.38.1
|
25 |
+
geojson==3.0.1
|
26 |
+
geopandas==0.13.2
|
setup.sh
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# sudo add-apt-repository ppa:ubuntugis/ppa && sudo apt-get update
|
2 |
+
# sudo apt-get update
|
3 |
+
# sudo apt-get install python3-dev
|
4 |
+
# sudo apt-get install gdal-bin
|
5 |
+
# sudo apt-get install libgdal-dev
|
6 |
+
# export CPLUS_INCLUDE_PATH=/usr/include/gdal
|
7 |
+
# export C_INCLUDE_PATH=/usr/include/gdal
|
8 |
+
# gdal-config --version
|
9 |
+
# pip install GDAL==$(gdal-config --version | awk -F'[.]' '{print $1"."$2}') localtileserver
|
10 |
+
|
11 |
+
mkdir -p ~/.streamlit/
|
12 |
+
echo "\
|
13 |
+
[server]\n\
|
14 |
+
headless = true\n\
|
15 |
+
port = $PORT\n\
|
16 |
+
enableCORS = false\n\
|
17 |
+
\n\
|
18 |
+
" > ~/.streamlit/config.toml
|
streamlit-template.code-workspace
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"folders": [
|
3 |
+
{
|
4 |
+
"name": "streamlit-template",
|
5 |
+
"path": "."
|
6 |
+
},
|
7 |
+
{
|
8 |
+
"name": "output",
|
9 |
+
"path": "../Omdena/canopy/Omdena_project_canopy/output"
|
10 |
+
}
|
11 |
+
],
|
12 |
+
"settings": {}
|
13 |
+
}
|