File size: 1,073 Bytes
62cf4ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
31
32
33
34
35
36
37
38
39
40
41
import streamlit as st
import asyncio
import nest_asyncio
from pickers import get_user_inputs
from utils import run_agent


nest_asyncio.apply()

# Set page config
st.set_page_config(page_title="Surf Spot Finder", page_icon="πŸ„", layout="wide")

# Add title and header
st.title("πŸ„ Surf Spot Finder")
st.markdown(
    "Find the best surfing spots based on your location and preferences! [Github Repo](https://github.com/mozilla-ai/surf-spot-finder)"
)

# Sidebar
with st.sidebar:
    st.markdown("### Configuration")
    st.markdown("Built using [Any-Agent](https://github.com/mozilla-ai/any-agent)")
    user_inputs = get_user_inputs()
    is_valid = user_inputs is not None
    run_button = st.button("Run", disabled=not is_valid, type="primary")


# Main content
async def main():
    if run_button:
        await run_agent(user_inputs)
    else:
        st.info(
            "πŸ‘ˆ Configure your search parameters in the sidebar and click Run to start!"
        )


if __name__ == "__main__":
    loop = asyncio.new_event_loop()
    loop.run_until_complete(main())