Skip to content

Commit

Permalink
Update 2_Chat_with_search.py
Browse files Browse the repository at this point in the history
  • Loading branch information
olyatjtaylo authored May 11, 2024
1 parent b60e600 commit 20567de
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions pages/2_Chat_with_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: <https://streamlit.geemap.org>
- GitHub repository: <https://github.com/giswqs/streamlit-geospatial>
"""
)

st.sidebar.title("Contact")
st.sidebar.info(
"""
Qiusheng Wu: <https://wetlands.io>
[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?"}
Expand Down

0 comments on commit 20567de

Please sign in to comment.