wanwanlin0521 commited on
Commit
7783047
·
verified ·
1 Parent(s): 7c3c069

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +5 -3
src/streamlit_app.py CHANGED
@@ -49,17 +49,18 @@ st.markdown(
49
  )
50
 
51
 
52
- # Define paths
 
53
  GEOJSON_PATH = Path(__file__).parent / "County_Boundary.geojson"
54
 
55
- # Load GeoJSON with error handling
56
  try:
57
  gdf_counties = gpd.read_file(GEOJSON_PATH)
58
  except FileNotFoundError:
59
  st.error("Error: 'County_Boundary.geojson' file not found in the /app/src/ directory. Please ensure the file is included in the project.")
60
  st.stop()
61
 
62
- # 1. Resolve the path to the CSV next to this script
63
  DATA_PATH = Path(__file__).parent / "crime_data.csv" # /app/src/crime_data.csv
64
 
65
  @st.cache_data
@@ -131,6 +132,7 @@ col3.metric(
131
  value=f"{top_share:.1%}"
132
  )
133
 
 
134
  # -------------------------------- Plot 1: Pie(Donut) Chart --------------------------------
135
  fig = px.pie(
136
  top_crimes,
 
49
  )
50
 
51
 
52
+ # Define paths.
53
+ # Path for geo_json.
54
  GEOJSON_PATH = Path(__file__).parent / "County_Boundary.geojson"
55
 
56
+ # Handle the error for geo_json.
57
  try:
58
  gdf_counties = gpd.read_file(GEOJSON_PATH)
59
  except FileNotFoundError:
60
  st.error("Error: 'County_Boundary.geojson' file not found in the /app/src/ directory. Please ensure the file is included in the project.")
61
  st.stop()
62
 
63
+ # Path for crime data.
64
  DATA_PATH = Path(__file__).parent / "crime_data.csv" # /app/src/crime_data.csv
65
 
66
  @st.cache_data
 
132
  value=f"{top_share:.1%}"
133
  )
134
 
135
+
136
  # -------------------------------- Plot 1: Pie(Donut) Chart --------------------------------
137
  fig = px.pie(
138
  top_crimes,