Spaces:
Runtime error
Runtime error
eaglelandsonce
commited on
Commit
•
6f59340
1
Parent(s):
21e744a
Update app.py
Browse files
app.py
CHANGED
@@ -1,26 +1,25 @@
|
|
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
-
#
|
4 |
-
|
5 |
-
'Residential Area': ['Energy Consumption', 'Water Usage'],
|
6 |
-
'Park': ['Air Quality', 'Noise Levels'],
|
7 |
-
'Main Street': ['Traffic Flow', 'Streetlight Activity'],
|
8 |
-
'Community Garden': ['Soil Moisture'],
|
9 |
-
'Local Business District': ['Retail Analytics', 'EV Charging Stations Usage']
|
10 |
-
}
|
11 |
|
12 |
-
#
|
13 |
-
|
14 |
|
15 |
-
#
|
16 |
-
|
17 |
-
for
|
18 |
-
st.write(f"- {data_point}")
|
19 |
|
20 |
-
#
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
#
|
24 |
-
st.
|
25 |
-
|
26 |
-
st.button("Submit Feedback")
|
|
|
1 |
+
import json
|
2 |
import streamlit as st
|
3 |
+
import matplotlib.pyplot as plt
|
4 |
|
5 |
+
# Page config
|
6 |
+
st.set_page_config(layout="wide")
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
+
# Load grid data
|
9 |
+
grid_data = json.load(open('grid.json'))
|
10 |
|
11 |
+
# Extract coordinates
|
12 |
+
buildings = [[b['coords'][0], b['coords'][1]] for b in grid_data['buildings']]
|
13 |
+
stores = [[s['coords'][0], s['coords'][1]] for s in grid_data['stores']]
|
|
|
14 |
|
15 |
+
# Plot map
|
16 |
+
fig, ax = plt.subplots()
|
17 |
+
ax.axis([0, 10, 0, 10])
|
18 |
+
ax.set_xticks([i for i in range(11)])
|
19 |
+
ax.set_yticks([i for i in range(11)])
|
20 |
+
ax.grid(color='grey', linestyle='-', linewidth=0.25)
|
21 |
+
ax.scatter(*zip(*buildings), color='red')
|
22 |
+
ax.scatter(*zip(*stores), color='green')
|
23 |
|
24 |
+
# Show figure in Streamlit
|
25 |
+
st.pyplot(fig)
|
|
|
|