Spaces:
Build error
Build error
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +11 -10
src/streamlit_app.py
CHANGED
|
@@ -53,6 +53,17 @@ st.markdown(
|
|
| 53 |
"""
|
| 54 |
)
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
# 1. Resolve the path to the CSV next to this script
|
| 57 |
DATA_PATH = Path(__file__).parent / "crime_data.csv" # /app/src/crime_data.csv
|
| 58 |
|
|
@@ -253,16 +264,6 @@ df_top = df[df['crm_cd_desc'].isin(top_10_crimes)]
|
|
| 253 |
crime_dropdown = ipywidgets.Dropdown(
|
| 254 |
options= sorted(top_10_crimes),
|
| 255 |
description="Crime Type:")
|
| 256 |
-
|
| 257 |
-
# Define the path to the GeoJSON file (relative to the script's location)
|
| 258 |
-
GEOJSON_PATH = Path(__file__).parent / "County_Boundary.geojson"
|
| 259 |
-
|
| 260 |
-
# Load the GeoJSON file with error handling
|
| 261 |
-
try:
|
| 262 |
-
gdf_counties = gpd.read_file(GEOJSON_PATH)
|
| 263 |
-
except FileNotFoundError:
|
| 264 |
-
st.error("Error: 'County_Boundary.geojson' file not found in the /app/src/ directory. Please ensure the file is included in the project.")
|
| 265 |
-
st.stop()
|
| 266 |
|
| 267 |
# Creat dropdown menu.
|
| 268 |
year_dropdown = ipywidgets.Dropdown(
|
|
|
|
| 53 |
"""
|
| 54 |
)
|
| 55 |
|
| 56 |
+
|
| 57 |
+
# Define paths
|
| 58 |
+
GEOJSON_PATH = Path(__file__).parent / "County_Boundary.geojson"
|
| 59 |
+
|
| 60 |
+
# Load GeoJSON with error handling
|
| 61 |
+
try:
|
| 62 |
+
gdf_counties = gpd.read_file(GEOJSON_PATH)
|
| 63 |
+
except FileNotFoundError:
|
| 64 |
+
st.error("Error: 'County_Boundary.geojson' file not found in the /app/src/ directory. Please ensure the file is included in the project.")
|
| 65 |
+
st.stop()
|
| 66 |
+
|
| 67 |
# 1. Resolve the path to the CSV next to this script
|
| 68 |
DATA_PATH = Path(__file__).parent / "crime_data.csv" # /app/src/crime_data.csv
|
| 69 |
|
|
|
|
| 264 |
crime_dropdown = ipywidgets.Dropdown(
|
| 265 |
options= sorted(top_10_crimes),
|
| 266 |
description="Crime Type:")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
|
| 268 |
# Creat dropdown menu.
|
| 269 |
year_dropdown = ipywidgets.Dropdown(
|