jeremyLE-Ekimetrics commited on
Commit
86735e0
1 Parent(s): f4c8c26
Files changed (1) hide show
  1. biomap/streamlit_app.py +41 -54
biomap/streamlit_app.py CHANGED
@@ -77,20 +77,16 @@ def app(model):
77
  if st.session_state["infered"]:
78
  st.plotly_chart(st.session_state["previous_fig"], use_container_width=True)
79
 
80
- m = folium.Map(location=[DEFAULT_LATITUDE, DEFAULT_LONGITUDE], zoom_start=DEFAULT_ZOOM)
81
- m.add_child(folium.LatLngPopup())
82
- tabs1, tabs2 = st.tabs(["TimeLapse", "Single Image"])
83
- with tabs1:
84
-
85
-
86
- submit = st.button("Predict TimeLapse", use_container_width=True, type="primary")
87
- st.session_state["submit"] = submit
88
-
89
- col_1, col_2 = st.columns([0.5,0.5])
90
- with col_1:
91
-
92
- f_map = st_folium(m, key="tab1", width=FOLIUM_WIDTH, height=FOLIUM_HEIGHT)
93
 
 
 
 
 
 
 
94
  selected_latitude = DEFAULT_LATITUDE
95
  selected_longitude = DEFAULT_LONGITUDE
96
 
@@ -98,53 +94,44 @@ def app(model):
98
  selected_latitude = f_map["last_clicked"]["lat"]
99
  selected_longitude = f_map["last_clicked"]["lng"]
100
 
101
- with col_2:
102
- col_tab1_1, col_tab1_2 = st.columns(2)
103
- with col_tab1_1:
104
- lat = st.text_input("latitude", value=selected_latitude)
105
- st.session_state["lat"] = lat
106
- with col_tab1_2:
107
- long = st.text_input("longitude", value=selected_longitude)
108
- st.session_state["long"] = long
109
-
110
- col_tab1_11, col_tab1_22 = st.columns(2)
111
- years = list(range(MIN_YEAR, MAX_YEAR, 1))
112
- with col_tab1_11:
113
- start_date = st.selectbox("Start date", years)
114
- st.session_state["start_date"] = start_date
115
-
116
- end_years = [year for year in years if year > start_date]
117
- with col_tab1_22:
118
- end_date = st.selectbox("End date", end_years)
119
- st.session_state["end_date"] = end_date
120
-
121
- segment_interval = st.radio("Interval of time between two segmentation", options=['month','2months', 'year'],horizontal=True)
122
- st.session_state["segment_interval"] = segment_interval
123
-
124
- with tabs2:
125
- submit2 = st.button("Predict Single Image", use_container_width=True, type="primary")
126
- st.session_state["submit2"] = submit2
127
-
128
- col_1_tab_2, col_2_tab_2 = st.columns([0.5,0.5])
129
- with col_1_tab_2:
130
- m_tab_2 = folium.Map(location=[DEFAULT_LATITUDE, DEFAULT_LONGITUDE], zoom_start=DEFAULT_ZOOM)
131
- m_tab_2.add_child(folium.LatLngPopup())
132
- f_map_tab_2 = st_folium(m, key="tab2", width=FOLIUM_WIDTH, height=FOLIUM_HEIGHT)
133
 
134
- selected_latitude_2 = DEFAULT_LATITUDE
135
- selected_longitude_2 = DEFAULT_LONGITUDE
136
 
137
- if f_map_tab_2.get("last_clicked"):
138
- selected_latitude_2 = f_map_tab_2["last_clicked"]["lat"]
139
- selected_longitude_2 = f_map_tab_2["last_clicked"]["lng"]
140
-
141
- with col_2_tab_2:
142
  col_tab2_1, col_tab2_2 = st.columns(2)
143
  with col_tab2_1:
144
- lat_2 = st.text_input("lat.", value=selected_latitude_2)
145
  st.session_state["lat_2"] = lat_2
146
  with col_tab2_2:
147
- long_2 = st.text_input("long.", value=selected_longitude_2)
148
  st.session_state["long_2"] = long_2
149
 
150
  date_2 = st.text_input("date", "2021-01-01", placeholder="2021-01-01")
 
77
  if st.session_state["infered"]:
78
  st.plotly_chart(st.session_state["previous_fig"], use_container_width=True)
79
 
80
+
81
+
82
+
 
 
 
 
 
 
 
 
 
 
83
 
84
+ col_1, col_2 = st.columns([0.5, 0.5])
85
+ with col_1:
86
+ m = folium.Map(location=[DEFAULT_LATITUDE, DEFAULT_LONGITUDE], zoom_start=DEFAULT_ZOOM)
87
+ m.add_child(folium.LatLngPopup())
88
+ f_map = st_folium(m, width=FOLIUM_WIDTH, height=FOLIUM_HEIGHT)
89
+
90
  selected_latitude = DEFAULT_LATITUDE
91
  selected_longitude = DEFAULT_LONGITUDE
92
 
 
94
  selected_latitude = f_map["last_clicked"]["lat"]
95
  selected_longitude = f_map["last_clicked"]["lng"]
96
 
97
+ with col_2:
98
+ tabs1, tabs2 = st.tabs(["TimeLapse", "Single Image"])
99
+ with tabs1:
100
+ submit = st.button("Predict TimeLapse", use_container_width=True, type="primary")
101
+ st.session_state["submit"] = submit
102
+
103
+ col_tab1_1, col_tab1_2 = st.columns(2)
104
+ with col_tab1_1:
105
+ lat = st.text_input("latitude", value=selected_latitude)
106
+ st.session_state["lat"] = lat
107
+ with col_tab1_2:
108
+ long = st.text_input("longitude", value=selected_longitude)
109
+ st.session_state["long"] = long
110
+
111
+ col_tab1_11, col_tab1_22 = st.columns(2)
112
+ years = list(range(MIN_YEAR, MAX_YEAR, 1))
113
+ with col_tab1_11:
114
+ start_date = st.selectbox("Start date", years)
115
+ st.session_state["start_date"] = start_date
116
+
117
+ end_years = [year for year in years if year > start_date]
118
+ with col_tab1_22:
119
+ end_date = st.selectbox("End date", end_years)
120
+ st.session_state["end_date"] = end_date
 
 
 
 
 
 
 
 
121
 
122
+ segment_interval = st.radio("Interval of time between two segmentation", options=['month','2months', 'year'],horizontal=True)
123
+ st.session_state["segment_interval"] = segment_interval
124
 
125
+ with tabs2:
126
+ submit2 = st.button("Predict Single Image", use_container_width=True, type="primary")
127
+ st.session_state["submit2"] = submit2
128
+
 
129
  col_tab2_1, col_tab2_2 = st.columns(2)
130
  with col_tab2_1:
131
+ lat_2 = st.text_input("lat.", value=selected_latitude)
132
  st.session_state["lat_2"] = lat_2
133
  with col_tab2_2:
134
+ long_2 = st.text_input("long.", value=selected_longitude)
135
  st.session_state["long_2"] = long_2
136
 
137
  date_2 = st.text_input("date", "2021-01-01", placeholder="2021-01-01")