Spaces:
Running
Running
Update new_app.py
Browse files- new_app.py +9 -6
new_app.py
CHANGED
|
@@ -98,17 +98,20 @@ with col3:
|
|
| 98 |
with st.form("coords_form"):
|
| 99 |
c1, c2 = st.columns(2)
|
| 100 |
with c1:
|
| 101 |
-
|
| 102 |
st.write('The current lat/long are:')
|
| 103 |
with c2:
|
| 104 |
-
|
| 105 |
-
st.write(f"{
|
| 106 |
submitted = st.form_submit_button("Get Image and Prediction")
|
| 107 |
|
| 108 |
if submitted:
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
with col2:
|
| 114 |
if state.coords_submitted:
|
|
|
|
| 98 |
with st.form("coords_form"):
|
| 99 |
c1, c2 = st.columns(2)
|
| 100 |
with c1:
|
| 101 |
+
st.number_input('Latitude', key="lat", value=float(state.lat), min_value=-90.0, max_value=90.0, step=0.01, format="%.4f")
|
| 102 |
st.write('The current lat/long are:')
|
| 103 |
with c2:
|
| 104 |
+
st.number_input('Longitude', key="lng", value=float(state.lng), min_value=-180.0, max_value=180.0, step=0.01, format="%.4f")
|
| 105 |
+
st.write(f"{st.session_state.lat:.2f}, {st.session_state.lng:.2f}")
|
| 106 |
submitted = st.form_submit_button("Get Image and Prediction")
|
| 107 |
|
| 108 |
if submitted:
|
| 109 |
+
try:
|
| 110 |
+
api_key = os.getenv("goog_api", "")
|
| 111 |
+
state.img = fetch_satellite_tile(st.session_state.lat, st.session_state.lng, api_key=api_key)
|
| 112 |
+
st.rerun() # ensures the updated lat/lng render immediately
|
| 113 |
+
except Exception as e:
|
| 114 |
+
st.error(f"Error fetching image: {e}")
|
| 115 |
|
| 116 |
with col2:
|
| 117 |
if state.coords_submitted:
|