-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplot-map.py
More file actions
63 lines (52 loc) · 1.65 KB
/
plot-map.py
File metadata and controls
63 lines (52 loc) · 1.65 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import plotly.graph_objects as go
import pandas as pd
import streamlit as st
# Read the data
data = pd.read_csv("last-month.csv") # This is just last month for testing, use permits-2020-onwards.csv for since 2020
mapbox_access_token = "pk.eyJ1Ijoicm9sYW5kZ2F2cmlsZXNjdSIsImEiOiJjajl6a2RiOXQ4c2xzMndzNDhkaWZpb3V6In0.7U26AzhPUHIYO_rfRZZReA"
# Make the figures
fig = go.Figure(go.Scattermapbox(
lat=data["LATITUDE"],
lon=data["LONGITUDE"],
mode='markers',
marker=go.scattermapbox.Marker(
size=3,
opacity=0.6
)
))
fig.update_layout(
hovermode='closest',
mapbox=dict(
accesstoken=mapbox_access_token,
bearing=0,
center=go.layout.mapbox.Center(
lat=40.730610,
lon=-73.935242
),
pitch=0,
zoom=10
)
)
import ask_ai
st.title("Kaya")
st.plotly_chart(fig)
if "messages" not in st.session_state:
st.session_state.messages = []
# Display chat messages from history on app rerun
for message in st.session_state.messages:
with st.chat_message(message["role"]):
st.markdown(message["content"])
# React to user input
if prompt := st.chat_input("Enter a message"):
# Add user message to chat history
st.session_state.messages.append({"role": "user", "content": prompt})
# Display user message in chat message container
with st.chat_message("user"):
st.markdown(prompt)
# Display assistant response in chat message container
with st.chat_message("assistant"):
message_placeholder = st.empty()
message_placeholder.text("Thinking...")
ai_message = ask_ai.ask_agent(prompt)
message_placeholder.markdown(ai_message)
st.session_state.messages.append({"role": "assistant", "content": ai_message})