Spaces:
Sleeping
Sleeping
Charles De Dampierre
commited on
Commit
•
916b870
1
Parent(s):
ab855e2
changes website
Browse files- __pycache__/region_list.cpython-311.pyc +0 -0
- app.py +166 -119
- data/immaterial_index/figures_trends_R/results/Western Europe.png +2 -2
- data/immaterial_index/figures_trends_R/results_per_capita/Western Europe.png +3 -0
- data/immaterial_index/figures_trends_R/test.png +2 -2
- image/Japan.jpeg +0 -0
- regions.toml +1 -0
__pycache__/region_list.cpython-311.pyc
CHANGED
Binary files a/__pycache__/region_list.cpython-311.pyc and b/__pycache__/region_list.cpython-311.pyc differ
|
|
app.py
CHANGED
@@ -4,11 +4,17 @@ import os
|
|
4 |
import pandas as pd
|
5 |
import tomli
|
6 |
|
|
|
7 |
pd.options.mode.chained_assignment = None
|
8 |
|
|
|
9 |
st.set_page_config(layout="wide")
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
12 |
|
13 |
|
14 |
@st.cache_data
|
@@ -41,135 +47,176 @@ def get_region_description(region_data, selected_region):
|
|
41 |
region_data = load_region_descriptions()
|
42 |
|
43 |
|
44 |
-
st.sidebar.
|
45 |
-
st.sidebar.
|
46 |
-
"
|
|
|
|
|
47 |
)
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
"data/immaterial_index/figures_trends_R/results_per_capita"
|
53 |
-
)
|
54 |
-
unseen_index_path = (
|
55 |
-
"data/immaterial_index/figures_trends_R/figures_unseen/results_unseen"
|
56 |
-
)
|
57 |
-
unseen_capita_index_path = (
|
58 |
-
"data/immaterial_index/figures_trends_R/figures_unseen/results_unseen/per_capita"
|
59 |
)
|
60 |
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
st.image(
|
139 |
-
Image.open(
|
140 |
-
caption=key.capitalize(),
|
141 |
use_column_width=True,
|
|
|
142 |
)
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
|
|
149 |
)
|
150 |
-
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
st.image(
|
153 |
Image.open(path),
|
154 |
caption=key.capitalize(),
|
155 |
use_column_width=True,
|
156 |
)
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
st.write(f"File for {key.capitalize()} does not exist.")
|
166 |
-
|
167 |
-
with col2:
|
168 |
-
try:
|
169 |
-
region_description = get_region_description(
|
170 |
-
region_data, selected_region
|
171 |
-
)
|
172 |
-
st.header("Analysis")
|
173 |
-
st.write(f"{region_description}")
|
174 |
-
except:
|
175 |
-
st.write("Analysis not ready yet")
|
|
|
4 |
import pandas as pd
|
5 |
import tomli
|
6 |
|
7 |
+
|
8 |
pd.options.mode.chained_assignment = None
|
9 |
|
10 |
+
|
11 |
st.set_page_config(layout="wide")
|
12 |
|
13 |
+
|
14 |
+
st.markdown(
|
15 |
+
"<div style='background-color: lightblue; text-align: center; padding: 10px;'><h1 style='font-size: 70px;'>Our History in Data</h1></div>",
|
16 |
+
unsafe_allow_html=True,
|
17 |
+
)
|
18 |
|
19 |
|
20 |
@st.cache_data
|
|
|
47 |
region_data = load_region_descriptions()
|
48 |
|
49 |
|
50 |
+
# page = st.sidebar.selectbox("Navigate to:", ["Home", "Methodology", "Team"])
|
51 |
+
page = st.sidebar.radio(
|
52 |
+
"Menu",
|
53 |
+
["Home", "Methodology", "Team", "About"],
|
54 |
+
key="navigation_radio",
|
55 |
)
|
56 |
|
57 |
+
|
58 |
+
st.sidebar.success(
|
59 |
+
"This project is led by Charles de Dampierre, Folgert Karsdorp, Mike Kestemont, Valentin Thouzeau and Nicolas Baumard"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
)
|
61 |
|
62 |
|
63 |
+
# Test change
|
64 |
+
if page == "Home":
|
65 |
+
|
66 |
+
# Set the global index path
|
67 |
+
global_index_path = "data/immaterial_index/figures_trends_R/results"
|
68 |
+
global_index_path_per_capita = (
|
69 |
+
"data/immaterial_index/figures_trends_R/results_per_capita"
|
70 |
+
)
|
71 |
+
unseen_index_path = (
|
72 |
+
"data/immaterial_index/figures_trends_R/figures_unseen/results_unseen"
|
73 |
+
)
|
74 |
+
unseen_capita_index_path = "data/immaterial_index/figures_trends_R/figures_unseen/results_unseen/per_capita"
|
75 |
+
|
76 |
+
population_path = "data/population"
|
77 |
+
maps_path = "data/map_figures"
|
78 |
+
|
79 |
+
from region_list import region_list
|
80 |
+
|
81 |
+
region_filtered = list(region_list.keys())
|
82 |
+
|
83 |
+
index_paths = {}
|
84 |
+
|
85 |
+
for region_key in region_list:
|
86 |
+
# Create the index paths for the current region
|
87 |
+
index_paths[region_key] = {
|
88 |
+
"map": f"{maps_path}/map_{region_key}.png",
|
89 |
+
"global_index": f"{global_index_path}/{region_key}.png",
|
90 |
+
"global_index_per_capita": f"{global_index_path_per_capita}/{region_key}.png",
|
91 |
+
"unseen_index": f"{unseen_index_path}/{region_key}.png",
|
92 |
+
"unseen_index_capita": f"{unseen_capita_index_path}/{region_key}.png",
|
93 |
+
"population_index": f"{population_path}/{region_key}.png",
|
94 |
+
}
|
95 |
+
|
96 |
+
# Get the region names (keys) from the index_paths dictionary
|
97 |
+
regions = list(index_paths.keys())
|
98 |
+
|
99 |
+
# Allow the user to select a region
|
100 |
+
selected_region = st.sidebar.selectbox(
|
101 |
+
"Region:", regions, index=regions.index("Japan")
|
102 |
+
)
|
103 |
+
|
104 |
+
# Display the selected region's images vertically
|
105 |
+
if selected_region in index_paths:
|
106 |
+
st.markdown(
|
107 |
+
f"<h1 style='text-align: left; font-size: 50px;'>{selected_region}</h1>",
|
108 |
+
unsafe_allow_html=True,
|
109 |
+
)
|
110 |
+
|
111 |
+
try:
|
112 |
+
st.image(
|
113 |
+
f"image/{selected_region}.jpeg",
|
114 |
+
caption="Japan",
|
115 |
+
use_column_width=False,
|
116 |
+
width=1000,
|
117 |
+
)
|
118 |
+
except:
|
119 |
+
pass
|
120 |
+
|
121 |
+
col1, col2, col3 = st.columns([8, 1, 8])
|
122 |
+
|
123 |
+
# Display the data in the left column
|
124 |
+
with col1:
|
125 |
+
for key, path in index_paths[selected_region].items():
|
126 |
+
if os.path.exists(path):
|
127 |
+
|
128 |
+
if key == "global_index":
|
129 |
+
st.subheader("Cultural Index")
|
130 |
+
st.image(
|
131 |
+
Image.open(path),
|
132 |
+
caption=key.capitalize(),
|
133 |
+
use_column_width=True,
|
134 |
+
)
|
135 |
+
elif key == "global_index_per_capita":
|
136 |
+
st.subheader("Cultural Index per capita")
|
137 |
+
st.image(
|
138 |
+
Image.open(path),
|
139 |
+
caption=key.capitalize(),
|
140 |
+
use_column_width=True,
|
141 |
+
)
|
142 |
+
elif key == "unseen_index":
|
143 |
+
st.subheader(
|
144 |
+
"Cultural Index corrected by the unseen-species model"
|
145 |
+
)
|
146 |
+
print(path)
|
147 |
+
st.image(
|
148 |
+
Image.open(path),
|
149 |
+
caption=key.capitalize(),
|
150 |
+
use_column_width=True,
|
151 |
+
)
|
152 |
+
elif key == "unseen_index_capita":
|
153 |
+
st.subheader(
|
154 |
+
"Cultural Index per capita corrected by the unseen-species model"
|
155 |
+
)
|
156 |
+
st.image(
|
157 |
+
Image.open(path),
|
158 |
+
caption=key.capitalize(),
|
159 |
+
use_column_width=True,
|
160 |
+
)
|
161 |
+
|
162 |
+
else:
|
163 |
+
st.write(f"File for {key.capitalize()} does not exist.")
|
164 |
+
|
165 |
+
with col3:
|
166 |
+
|
167 |
+
try:
|
168 |
st.image(
|
169 |
+
Image.open(f"data/map_figures/map_{selected_region}.png"),
|
|
|
170 |
use_column_width=True,
|
171 |
+
width=1000,
|
172 |
)
|
173 |
+
except:
|
174 |
+
pass
|
175 |
+
|
176 |
+
st.subheader("Analysis")
|
177 |
+
try:
|
178 |
+
region_description = get_region_description(
|
179 |
+
region_data, selected_region
|
180 |
)
|
181 |
+
st.write(f"{region_description}")
|
182 |
+
except:
|
183 |
+
st.write("Analysis not ready yet")
|
184 |
+
|
185 |
+
st.subheader("Cultural Producers in Wikidata")
|
186 |
+
df = df_ind[df_ind["region_name"] == selected_region]
|
187 |
+
df = df.drop(["region_name", "decade"], axis=1)
|
188 |
+
df = df[
|
189 |
+
[
|
190 |
+
"individual_name",
|
191 |
+
"productive_year",
|
192 |
+
"score",
|
193 |
+
"individual_wikidata_id" "",
|
194 |
+
]
|
195 |
+
]
|
196 |
+
df = df.sort_values("score", ascending=False)
|
197 |
+
df = df.rename(columns={"score": "Number of Catalogs"})
|
198 |
+
|
199 |
+
min_date = region_list[selected_region]["time_range"][0]
|
200 |
+
max_date = region_list[selected_region]["time_range"][1]
|
201 |
+
df = df[df["productive_year"] >= min_date]
|
202 |
+
df = df[df["productive_year"] <= max_date]
|
203 |
+
df["productive_year"] = df["productive_year"].astype(int)
|
204 |
+
df = df.reset_index(drop=True)
|
205 |
+
st.dataframe(df)
|
206 |
+
st.write(f"Number of Cultural producers active before 1800: {len(df)}")
|
207 |
+
|
208 |
+
try:
|
209 |
+
st.subheader("Population")
|
210 |
st.image(
|
211 |
Image.open(path),
|
212 |
caption=key.capitalize(),
|
213 |
use_column_width=True,
|
214 |
)
|
215 |
+
except:
|
216 |
+
pass
|
217 |
+
|
218 |
+
|
219 |
+
elif page == "Methodology":
|
220 |
+
# Add content for the Methodology section here
|
221 |
+
st.markdown("<h2>Methodology</h2>", unsafe_allow_html=True)
|
222 |
+
st.write("Here you can describe the methodology used in your project.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/immaterial_index/figures_trends_R/results/Western Europe.png
CHANGED
Git LFS Details
|
Git LFS Details
|
data/immaterial_index/figures_trends_R/results_per_capita/Western Europe.png
ADDED
Git LFS Details
|
data/immaterial_index/figures_trends_R/test.png
CHANGED
Git LFS Details
|
Git LFS Details
|
image/Japan.jpeg
ADDED
regions.toml
CHANGED
@@ -17,6 +17,7 @@ century and recovery from the 13th to 16th centuries Nakabayashi et al. (2020).
|
|
17 |
|
18 |
In line with this study Nakabayashi et al. (2020), our results also suggest that the recovery of the economic development began in
|
19 |
the 13th during the Kamakura shogunate, earlier than what was previously estimated.
|
|
|
20 |
Our result also allows to have finer temporal estimation. For instance, we observe that the isolation of
|
21 |
the country (the sakoku policy) starting in 1633 did not impact economic cultural production. At the other
|
22 |
end of the period, we can see that cultural production was already very robust before the Meiji reforms
|
|
|
17 |
|
18 |
In line with this study Nakabayashi et al. (2020), our results also suggest that the recovery of the economic development began in
|
19 |
the 13th during the Kamakura shogunate, earlier than what was previously estimated.
|
20 |
+
|
21 |
Our result also allows to have finer temporal estimation. For instance, we observe that the isolation of
|
22 |
the country (the sakoku policy) starting in 1633 did not impact economic cultural production. At the other
|
23 |
end of the period, we can see that cultural production was already very robust before the Meiji reforms
|