jableable commited on
Commit
b3ca0aa
·
verified ·
1 Parent(s): 230f41d

Update new_app.py

Browse files
Files changed (1) hide show
  1. new_app.py +15 -12
new_app.py CHANGED
@@ -94,18 +94,21 @@ if state.img is None:
94
  col1, col2, col3 = st.columns([0.8, 1.8, 1.0]) # adjust ratios to taste
95
 
96
  with col3:
97
- #header
98
- st.subheader('Enter latitude/longitude coordinates:')
99
- coll, colr= st.columns(2)
100
- with coll:
101
- state.lat = st.number_input('Latitude', value=39.11, min_value=-90., max_value=90., step=.01)
102
- st.write('The current lat/long are:')
103
- with colr:
104
- state.lng = st.number_input('Longitude', value=-86.56, min_value=-180., max_value=180., step=.01)
105
- st.write(str(state.lat)+', '+str(state.lng))
106
- with st.form("my_form"):
107
- submit_button = st.form_submit_button(
108
- label="Get Image and Prediction", on_click=lambda: state.update(coords_submitted=True))
 
 
 
109
 
110
  with col2:
111
  if state.coords_submitted:
 
94
  col1, col2, col3 = st.columns([0.8, 1.8, 1.0]) # adjust ratios to taste
95
 
96
  with col3:
97
+ st.subheader('Enter latitude/longitude coordinates:')
98
+ with st.form("coords_form"):
99
+ c1, c2 = st.columns(2)
100
+ with c1:
101
+ lat_input = st.number_input('Latitude', value=float(state.lat), min_value=-90., max_value=90., step=.01)
102
+ st.write('The current lat/long are:')
103
+ with c2:
104
+ lng_input = st.number_input('Longitude', value=float(state.lng), min_value=-180., max_value=180., step=.01)
105
+ st.write(f"{state.lat:.2f}, {state.lng:.2f}")
106
+ submitted = st.form_submit_button("Get Image and Prediction")
107
+
108
+ if submitted:
109
+ api_key = os.getenv("goog_api", "")
110
+ state.lat, state.lng = float(lat_input), float(lng_input)
111
+ state.img = fetch_satellite_tile(state.lat, state.lng, api_key=api_key)
112
 
113
  with col2:
114
  if state.coords_submitted: