gtano commited on
Commit
9633fb1
·
1 Parent(s): db9dca3

Changes to layout

Browse files
Files changed (1) hide show
  1. app.py +35 -25
app.py CHANGED
@@ -7,6 +7,7 @@ import streamlit as st
7
  from loguru import logger as log
8
  from matplotlib import colors
9
  from streamlit_folium import st_folium
 
10
  from utils.folium import (
11
  draw_gdf,
12
  get_clean_rendering_container,
@@ -46,15 +47,6 @@ def style_call(feat):
46
  # Page configs
47
  st.set_page_config(page_title="AIDA", page_icon="🌐", layout="wide")
48
 
49
- hide_button_style = """
50
- <style>
51
- div.stButton > button:first-child {
52
- display: none;
53
- }
54
- </style>
55
- """
56
- st.markdown(hide_button_style, unsafe_allow_html=True)
57
-
58
  # base paths
59
  base_path = Path("data")
60
  inference_path = base_path / "inference"
@@ -65,15 +57,22 @@ inference_paths = sorted(list(inference_path.iterdir()))
65
  example_names = [p.stem for p in inference_paths]
66
  inference_dict = {p.stem: p for p in inference_paths}
67
 
 
 
 
 
 
68
  # Create selection menu
69
- container_predictions = st.sidebar.container(border=True)
70
  with container_predictions:
71
- prediction_selectbox = st.selectbox(
72
- "Select an example",
73
- options=example_names,
74
- index=None,
75
- key="selectbox_pred",
76
- )
 
 
77
  is_prediction_selected = prediction_selectbox is not None
78
  if is_prediction_selected:
79
  try:
@@ -88,22 +87,32 @@ with container_predictions:
88
  else:
89
  prediction_file = None
90
  chosen_tile_path = None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
  container = get_clean_rendering_container(prediction_selectbox)
93
 
94
 
95
  # Stange Hack to always update the map height I guess
96
- def change_key():
97
- st.session_state["key_map"] = str(datetime.now())
98
 
99
 
100
- height_value = st.sidebar.radio(
101
- "Map height",
102
- options=[800, 500],
103
- horizontal=True,
104
- key="height_map",
105
- on_change=change_key,
106
- )
107
  container = get_clean_rendering_container(height_value)
108
 
109
  # draw map
@@ -115,6 +124,7 @@ if prediction_selectbox is not None:
115
 
116
 
117
  with container.form(key="form1", clear_on_submit=True):
 
118
  folium.LayerControl().add_to(interactive_map)
119
  output_map = st_folium(
120
  interactive_map,
 
7
  from loguru import logger as log
8
  from matplotlib import colors
9
  from streamlit_folium import st_folium
10
+
11
  from utils.folium import (
12
  draw_gdf,
13
  get_clean_rendering_container,
 
47
  # Page configs
48
  st.set_page_config(page_title="AIDA", page_icon="🌐", layout="wide")
49
 
 
 
 
 
 
 
 
 
 
50
  # base paths
51
  base_path = Path("data")
52
  inference_path = base_path / "inference"
 
57
  example_names = [p.stem for p in inference_paths]
58
  inference_dict = {p.stem: p for p in inference_paths}
59
 
60
+
61
+ def change_key():
62
+ st.session_state["key_map"] = str(datetime.now())
63
+
64
+
65
  # Create selection menu
66
+ container_predictions = st.container(border=True)
67
  with container_predictions:
68
+ col1, col2, col3 = st.columns([0.2, 0.1, 0.7])
69
+ with col1:
70
+ prediction_selectbox = st.selectbox(
71
+ "Select an example",
72
+ options=example_names,
73
+ index=None,
74
+ key="selectbox_pred",
75
+ )
76
  is_prediction_selected = prediction_selectbox is not None
77
  if is_prediction_selected:
78
  try:
 
87
  else:
88
  prediction_file = None
89
  chosen_tile_path = None
90
+ with col2:
91
+ height_value = st.radio(
92
+ "Map height",
93
+ options=[800, 500],
94
+ horizontal=True,
95
+ key="height_map",
96
+ on_change=change_key,
97
+ )
98
+ with col3:
99
+ with st.container():
100
+ st.write("######")
101
+ with st.expander("See information about the methodology"):
102
+ st.write(
103
+ """The model uses a modified UTAE architecture, a U-Net variant with attention,
104
+ for segmenting crop types from satellite imagery.
105
+ It was trained using Sentinel-2 time series data from several European countries,
106
+ labeled with aggregated Eurocrops data to identify 6 broad crop classes.
107
+ More informations about the methodology [HERE](https://huggingface.co/links-ads/aida-cropland-models)"""
108
+ )
109
 
110
  container = get_clean_rendering_container(prediction_selectbox)
111
 
112
 
113
  # Stange Hack to always update the map height I guess
 
 
114
 
115
 
 
 
 
 
 
 
 
116
  container = get_clean_rendering_container(height_value)
117
 
118
  # draw map
 
124
 
125
 
126
  with container.form(key="form1", clear_on_submit=True):
127
+
128
  folium.LayerControl().add_to(interactive_map)
129
  output_map = st_folium(
130
  interactive_map,