Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -102,19 +102,20 @@ if viz_type == "Complaints Over Time":
|
|
| 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 |
-
selected_block = 'All Blocks' # Default value
|
| 107 |
if viz_type in [
|
| 108 |
"Complaints by Housing Block and Type",
|
| 109 |
"Complaints by Housing Block and Type (Incorporating Suggestions Based on Professor's Feedback)"
|
| 110 |
]:
|
| 111 |
block_options = ['All Blocks'] + sorted(data['Housing Block'].unique().tolist())
|
|
|
|
|
|
|
| 112 |
selected_block = st.sidebar.selectbox(
|
| 113 |
"Select Housing Block",
|
| 114 |
options=block_options,
|
| 115 |
-
key=
|
| 116 |
)
|
| 117 |
-
|
|
|
|
| 118 |
|
| 119 |
# # Ensuring selected_block is only used if defined
|
| 120 |
# 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 |
if viz_type in [
|
| 106 |
"Complaints by Housing Block and Type",
|
| 107 |
"Complaints by Housing Block and Type (Incorporating Suggestions Based on Professor's Feedback)"
|
| 108 |
]:
|
| 109 |
block_options = ['All Blocks'] + sorted(data['Housing Block'].unique().tolist())
|
| 110 |
+
# Unique key for each viz_type
|
| 111 |
+
block_key = f"block_select_{viz_type.replace(' ', '_')}"
|
| 112 |
selected_block = st.sidebar.selectbox(
|
| 113 |
"Select Housing Block",
|
| 114 |
options=block_options,
|
| 115 |
+
key=block_key
|
| 116 |
)
|
| 117 |
+
else:
|
| 118 |
+
selected_block = 'All Blocks'
|
| 119 |
|
| 120 |
# # Ensuring selected_block is only used if defined
|
| 121 |
# 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():
|