Spaces:
Sleeping
Sleeping
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") | |