ralate2 commited on
Commit
ea40752
·
verified ·
1 Parent(s): 932a32f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -102,16 +102,17 @@ if viz_type == "Complaints Over Time":
102
  # key=f"block_select_{viz_type}" # Unique key for each visualization
103
  # )
104
 
 
105
  if viz_type in ["Complaints by Housing Block and Type",
106
  "Complaints by Housing Block and Type (Incorporating Suggestions Based on Professor's Feedback)"]:
107
  block_options = ['All Blocks'] + sorted(data['Housing Block'].unique().tolist())
108
  selected_block = st.sidebar.selectbox(
109
  "Select Housing Block",
110
  options=block_options,
111
- key="block_select" # Single key for the dropdown
112
  )
113
  else:
114
- selected_block = 'All Blocks'
115
 
116
  # # Ensuring selected_block is only used if defined
117
  # if viz_type in ["Complaints by Housing Block and Type", "Complaints by Housing Block and Type (Incorporating Suggestions Based on Professor's Feedback)"] and 'selected_block' not in locals():
 
102
  # key=f"block_select_{viz_type}" # Unique key for each visualization
103
  # )
104
 
105
+ # Dropdown for Housing Block (only show for relevant visualizations)
106
  if viz_type in ["Complaints by Housing Block and Type",
107
  "Complaints by Housing Block and Type (Incorporating Suggestions Based on Professor's Feedback)"]:
108
  block_options = ['All Blocks'] + sorted(data['Housing Block'].unique().tolist())
109
  selected_block = st.sidebar.selectbox(
110
  "Select Housing Block",
111
  options=block_options,
112
+ key=f"block_select_{viz_type.replace(' ', '_')}" # Unique key for each visualization
113
  )
114
  else:
115
+ selected_block = 'All Blocks' # Default value if not applicable
116
 
117
  # # Ensuring selected_block is only used if defined
118
  # if viz_type in ["Complaints by Housing Block and Type", "Complaints by Housing Block and Type (Incorporating Suggestions Based on Professor's Feedback)"] and 'selected_block' not in locals():