diff --git a/pages/2_Chat_with_search.py b/pages/2_Chat_with_search.py index 399c5821..12de4a9b 100644 --- a/pages/2_Chat_with_search.py +++ b/pages/2_Chat_with_search.py @@ -19,7 +19,70 @@ In this example, we're using `StreamlitCallbackHandler` to display the thoughts and actions of an agent in an interactive Streamlit app. Try more LangChain 🤝 Streamlit Agent examples at [github.com/langchain-ai/streamlit-agent](https://github.com/langchain-ai/streamlit-agent). """ +import streamlit as st +import leafmap.foliumap as leafmap + +st.set_page_config(layout="wide") + +st.sidebar.info( + """ + - Web App URL: + - GitHub repository: + """ +) + +st.sidebar.title("Contact") +st.sidebar.info( + """ + Qiusheng Wu: + [GitHub](https://github.com/giswqs) | [Twitter](https://twitter.com/giswqs) | [YouTube](https://www.youtube.com/c/QiushengWu) | [LinkedIn](https://www.linkedin.com/in/qiushengwu) + """ +) + + +def app(): + st.title("Search Basemaps") + st.markdown( + """ + This app is a demonstration of searching and loading basemaps from [xyzservices](https://github.com/geopandas/xyzservices) and [Quick Map Services (QMS)](https://github.com/nextgis/quickmapservices). Selecting from 1000+ basemaps with a few clicks. + """ + ) + + with st.expander("See demo"): + st.image("https://i.imgur.com/0SkUhZh.gif") + + row1_col1, row1_col2 = st.columns([3, 1]) + width = 800 + height = 600 + tiles = None + + with row1_col2: + + checkbox = st.checkbox("Search Quick Map Services (QMS)") + keyword = st.text_input("Enter a keyword to search and press Enter:") + empty = st.empty() + + if keyword: + options = leafmap.search_xyz_services(keyword=keyword) + if checkbox: + qms = leafmap.search_qms(keyword=keyword) + if qms is not None: + options = options + qms + + tiles = empty.multiselect( + "Select XYZ tiles to add to the map:", options) + + with row1_col1: + m = leafmap.Map() + + if tiles is not None: + for tile in tiles: + m.add_xyz_service(tile) + + m.to_streamlit(height=height) + +app() if "messages" not in st.session_state: st.session_state["messages"] = [ {"role": "assistant", "content": "Hi, I'm a chatbot who can search the web. How can I help you?"}