Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
import csv
|
|
|
3 |
|
4 |
# Define the state populations and family sizes
|
5 |
state_data = {
|
@@ -50,21 +51,22 @@ def main():
|
|
50 |
writer.writeheader()
|
51 |
for state in state_list:
|
52 |
writer.writerow(state)
|
|
|
|
|
53 |
st.markdown(f'<a href="data:file/csv;base64,{b64}" download="state_data.csv">Download State Data CSV File</a>', unsafe_allow_html=True)
|
54 |
|
55 |
# Display state populations and family sizes
|
56 |
st.header('Population and Family Size')
|
57 |
for state, data in state_data.items():
|
58 |
st.subheader(f'{POPULATION_ICON} {state}')
|
59 |
-
|
60 |
-
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
|
70 |
-
main()
|
|
|
1 |
import streamlit as st
|
2 |
import csv
|
3 |
+
import base64
|
4 |
|
5 |
# Define the state populations and family sizes
|
6 |
state_data = {
|
|
|
51 |
writer.writeheader()
|
52 |
for state in state_list:
|
53 |
writer.writerow(state)
|
54 |
+
with open('state_data.csv', mode='rb') as file:
|
55 |
+
b64 = base64.b64encode(file.read()).decode('utf-8')
|
56 |
st.markdown(f'<a href="data:file/csv;base64,{b64}" download="state_data.csv">Download State Data CSV File</a>', unsafe_allow_html=True)
|
57 |
|
58 |
# Display state populations and family sizes
|
59 |
st.header('Population and Family Size')
|
60 |
for state, data in state_data.items():
|
61 |
st.subheader(f'{POPULATION_ICON} {state}')
|
62 |
+
st.write(f'Population: {data["population"]}')
|
63 |
+
st.write(f'Family Size: {data["family_size"]}')
|
64 |
|
65 |
+
# Display state spending data
|
66 |
+
st.header('State Spending')
|
67 |
+
for state, data in spending_data.items():
|
68 |
+
st.subheader(state)
|
69 |
+
st.write(f'{EDUCATION_ICON} Education: {data["education"]}')
|
70 |
+
st.write(f'{HEALTHCARE_ICON} Healthcare: {data["healthcare"]}')
|
71 |
+
st.write(f'{TRANSPORTATION_ICON} Transportation: {data["transportation"]}')
|
72 |
|
|