YashMK89 commited on
Commit
fb8b839
·
verified ·
1 Parent(s): f3fab6d

update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -9
app.py CHANGED
@@ -34,11 +34,18 @@ st.write(
34
  """,
35
  unsafe_allow_html=True,
36
  )
 
 
 
 
 
 
 
37
 
38
- # Authenticate and initialize Earth Engine
39
  earthengine_credentials = os.environ.get("EE_Authentication")
40
 
41
- # Initialize Earth Engine with secret credentials
42
  os.makedirs(os.path.expanduser("~/.config/earthengine/"), exist_ok=True)
43
  with open(os.path.expanduser("~/.config/earthengine/credentials"), "w") as f:
44
  f.write(earthengine_credentials)
@@ -137,13 +144,13 @@ end_date = st.date_input("End Date", value=pd.to_datetime('2020-12-31'))
137
  start_date_str = start_date.strftime('%Y-%m-%d')
138
  end_date_str = end_date.strftime('%Y-%m-%d')
139
 
140
- # Initialize session state for storing results if not already done
141
- if 'results' not in st.session_state:
142
- st.session_state.results = []
143
- if 'last_params' not in st.session_state:
144
- st.session_state.last_params = {}
145
- if 'map_data' not in st.session_state:
146
- st.session_state.map_data = None # Initialize map_data
147
 
148
  # Function to check if parameters have changed
149
  def parameters_changed():
 
34
  """,
35
  unsafe_allow_html=True,
36
  )
37
+ # Initialize session state for storing results if not already done
38
+ if 'results' not in st.session_state:
39
+ st.session_state.results = []
40
+ if 'last_params' not in st.session_state:
41
+ st.session_state.last_params = {}
42
+ if 'map_data' not in st.session_state:
43
+ st.session_state.map_data = None # Initialize map_data
44
 
45
+ # Initialize Earth Engine with secret credentials
46
  earthengine_credentials = os.environ.get("EE_Authentication")
47
 
48
+ # Initialize Earth Engine with credentials
49
  os.makedirs(os.path.expanduser("~/.config/earthengine/"), exist_ok=True)
50
  with open(os.path.expanduser("~/.config/earthengine/credentials"), "w") as f:
51
  f.write(earthengine_credentials)
 
144
  start_date_str = start_date.strftime('%Y-%m-%d')
145
  end_date_str = end_date.strftime('%Y-%m-%d')
146
 
147
+ # # Initialize session state for storing results if not already done
148
+ # if 'results' not in st.session_state:
149
+ # st.session_state.results = []
150
+ # if 'last_params' not in st.session_state:
151
+ # st.session_state.last_params = {}
152
+ # if 'map_data' not in st.session_state:
153
+ # st.session_state.map_data = None # Initialize map_data
154
 
155
  # Function to check if parameters have changed
156
  def parameters_changed():