Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
# Define the state populations and family sizes
|
4 |
+
state_data = {
|
5 |
+
'California': {'population': 39538223, 'family_size': 3.3},
|
6 |
+
'Texas': {'population': 29145505, 'family_size': 3.4},
|
7 |
+
'Florida': {'population': 21538187, 'family_size': 3.0},
|
8 |
+
'New York': {'population': 19849399, 'family_size': 3.1},
|
9 |
+
'Minnesota': {'population': 5700671, 'family_size': 2.5},
|
10 |
+
'Wisconsin': {'population': 5897473, 'family_size': 2.6},
|
11 |
+
}
|
12 |
+
|
13 |
+
# Define the state spending data
|
14 |
+
spending_data = {
|
15 |
+
'California': {'education': 2500, 'healthcare': 3000, 'transportation': 1500},
|
16 |
+
'Texas': {'education': 2000, 'healthcare': 2500, 'transportation': 1000},
|
17 |
+
'Florida': {'education': 1500, 'healthcare': 2000, 'transportation': 750},
|
18 |
+
'New York': {'education': 3000, 'healthcare': 3500, 'transportation': 2000},
|
19 |
+
'Minnesota': {'education': 1000, 'healthcare': 1500, 'transportation': 500},
|
20 |
+
'Wisconsin': {'education': 1250, 'healthcare': 1750, 'transportation': 750},
|
21 |
+
}
|
22 |
+
|
23 |
+
# Define the emoji icons
|
24 |
+
POPULATION_ICON = 'π₯'
|
25 |
+
FAMILY_SIZE_ICON = 'π¨βπ©βπ§βπ¦'
|
26 |
+
EDUCATION_ICON = 'π«'
|
27 |
+
HEALTHCARE_ICON = 'π₯'
|
28 |
+
TRANSPORTATION_ICON = 'π'
|
29 |
+
|
30 |
+
def main():
|
31 |
+
st.title('State Comparison')
|
32 |
+
|
33 |
+
# Display state populations and family sizes
|
34 |
+
st.header('Population and Family Size')
|
35 |
+
for state, data in state_data.items():
|
36 |
+
st.subheader(f'{POPULATION_ICON} {state}')
|
37 |
+
st.write(f'Population: {data["population"]}')
|
38 |
+
st.write(f'Family Size: {data["family_size"]}')
|
39 |
+
|
40 |
+
# Display state spending data
|
41 |
+
st.header('State Spending')
|
42 |
+
for state, data in spending_data.items():
|
43 |
+
st.subheader(state)
|
44 |
+
st.write(f'{EDUCATION_ICON} Education: {data["education"]}')
|
45 |
+
st.write(f'{HEALTHCARE_ICON} Healthcare: {data["healthcare"]}')
|
46 |
+
st.write(f'{TRANSPORTATION_ICON} Transportation: {data["transportation"]}')
|
47 |
+
|
48 |
+
|
49 |
+
if __name__ == '__main__':
|
50 |
+
main()
|