File size: 954 Bytes
9f5a064
 
a5a69f4
9f5a064
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70db531
 
9f5a064
 
 
a5a69f4
4a4b65e
9f5a064
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import streamlit as st
import pandas as pd
from latloncover.classify import add_classifications

st.title("LatLonCover Demo")
st.subheader('Add land coverage data to a CSV :sunglasses:')
st.markdown("[Learn more about LatLonCover.](https://github.com/Imageomics/LatLonCover)")

st.text("Upload a CSV file with latitude and longitude columns.")

col1, col2 = st.columns(2)

with col1:
    lat_col = st.text_input('Enter the latitude column name', 'Lat')

with col2:
    # Using "Long" to match Andromeda column name
    lon_col = st.text_input('Enter the longitude column name', 'Long')

uploaded_file = st.file_uploader("Choose a CSV file")

if st.button('Process CSV') and uploaded_file is not None:
   df = pd.read_csv(uploaded_file)

   with st.spinner('Fetching land coverage data...'):
       df = add_classifications(df, lat_col=lat_col, lon_col=lon_col)
   st.download_button('Download CSV', df.to_csv(index=False), file_name="LatLonCover.csv")