Spaces:
Sleeping
Sleeping
Charles De Dampierre
commited on
Commit
•
026a3b5
1
Parent(s):
3e91b4d
changes
Browse files- README.md +8 -0
- __pycache__/region_list.cpython-310.pyc +0 -0
- app.py +60 -43
- data/df_individuals_score.csv +3 -0
- region_list.py +92 -0
README.md
CHANGED
@@ -15,4 +15,12 @@ Check out the configuration reference at <https://huggingface.co/docs/hub/spaces
|
|
15 |
|
16 |
```bash
|
17 |
git lfs track "*.png"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
``````
|
|
|
15 |
|
16 |
```bash
|
17 |
git lfs track "*.png"
|
18 |
+
git lfs track "*.csv"
|
19 |
+
```
|
20 |
+
|
21 |
+
### Removing commit
|
22 |
+
|
23 |
+
```bash
|
24 |
+
git reset --hard HEAD~1
|
25 |
+
|
26 |
``````
|
__pycache__/region_list.cpython-310.pyc
ADDED
Binary file (1.09 kB). View file
|
|
app.py
CHANGED
@@ -1,12 +1,32 @@
|
|
1 |
import streamlit as st
|
2 |
from PIL import Image
|
3 |
import os
|
|
|
4 |
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
st.title("Our History in Data")
|
7 |
|
8 |
# Set the global index path
|
9 |
global_index_path = "data/immaterial_index/figures_trends_R/results"
|
|
|
|
|
|
|
10 |
unseen_index_path = (
|
11 |
"data/immaterial_index/figures_trends_R/figures_unseen/results_unseen"
|
12 |
)
|
@@ -19,61 +39,61 @@ population_path = "data/population"
|
|
19 |
maps_path = "data/map_figures"
|
20 |
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
"map": f"{maps_path}/map_Indian world.png",
|
26 |
-
"global_index": f"{global_index_path}/india.png",
|
27 |
-
"unseen_index": f"{unseen_index_path}/india.png",
|
28 |
-
"unseen_index_capita": f"{unseen_capita_index_path}/india.png",
|
29 |
-
"population_index": f"{population_path}/Indian world.png",
|
30 |
-
},
|
31 |
-
"Japan": {
|
32 |
-
"map": f"{maps_path}/map_Japan.png",
|
33 |
-
"global_index": f"{global_index_path}/japan.png",
|
34 |
-
"unseen_index": f"{unseen_index_path}/japan.png",
|
35 |
-
"unseen_index_capita": f"{unseen_capita_index_path}/Japan.png",
|
36 |
-
"population_index": f"{population_path}/Japan.png",
|
37 |
-
},
|
38 |
-
"France": {
|
39 |
-
"map": f"{maps_path}/map_France.png",
|
40 |
-
"global_index": f"{global_index_path}/france.png",
|
41 |
-
"unseen_index": f"{unseen_index_path}/france.png",
|
42 |
-
"unseen_index_capita": f"{unseen_capita_index_path}/France.png",
|
43 |
-
"population_index": f"{population_path}/France.png",
|
44 |
-
},
|
45 |
-
"Italy": {
|
46 |
-
"map": f"{maps_path}/map_Italy.png",
|
47 |
-
"global_index": f"{global_index_path}/italy.png",
|
48 |
-
"unseen_index": f"{unseen_index_path}/italy.png",
|
49 |
-
"unseen_index_capita": f"{unseen_capita_index_path}/Italy.png",
|
50 |
-
"population_index": f"{population_path}/Italy.png",
|
51 |
-
},
|
52 |
-
"Spain": {
|
53 |
-
"map": f"{maps_path}/map_Spain.png",
|
54 |
-
"global_index": f"{global_index_path}/spain.png",
|
55 |
-
"unseen_index": f"{unseen_index_path}/spain.png",
|
56 |
-
"unseen_index_capita": f"{unseen_capita_index_path}/Spain.png",
|
57 |
-
"population_index": f"{population_path}/Spain.png",
|
58 |
-
},
|
59 |
-
}
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
# Get the region names (keys) from the index_paths dictionary
|
63 |
regions = list(index_paths.keys())
|
64 |
|
65 |
# Allow the user to select a region
|
66 |
-
selected_region = st.sidebar.selectbox("Region:", regions)
|
67 |
|
68 |
# Display the selected region's images vertically
|
69 |
if selected_region in index_paths:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
for key, path in index_paths[selected_region].items():
|
71 |
if os.path.exists(path):
|
|
|
72 |
if key == "global_index":
|
73 |
st.subheader("Global Index")
|
74 |
st.image(
|
75 |
Image.open(path), caption=key.capitalize(), use_column_width=True
|
76 |
)
|
|
|
|
|
|
|
|
|
|
|
77 |
elif key == "unseen_index":
|
78 |
st.subheader("Unsee-Species Index")
|
79 |
st.image(
|
@@ -85,7 +105,7 @@ if selected_region in index_paths:
|
|
85 |
Image.open(path), caption=key.capitalize(), use_column_width=True
|
86 |
)
|
87 |
elif key == "population_index":
|
88 |
-
st.subheader("
|
89 |
st.image(
|
90 |
Image.open(path), caption=key.capitalize(), use_column_width=True
|
91 |
)
|
@@ -96,6 +116,3 @@ if selected_region in index_paths:
|
|
96 |
)
|
97 |
else:
|
98 |
st.write(f"File for {key.capitalize()} does not exist.")
|
99 |
-
# Add more information or charts specific to India here
|
100 |
-
else:
|
101 |
-
st.write("Please select India as the region from the sidebar on the left.")
|
|
|
1 |
import streamlit as st
|
2 |
from PIL import Image
|
3 |
import os
|
4 |
+
import pandas as pd
|
5 |
|
6 |
|
7 |
+
@st.cache
|
8 |
+
def load_data():
|
9 |
+
df_ind = pd.read_csv("data/df_individuals_score.csv", index_col=[0])
|
10 |
+
df_ind = df_ind.drop("region_code", axis=1)
|
11 |
+
df_ind["productive_year"] = df_ind["productive_year"].astype(int)
|
12 |
+
df_ind["individual_wikidata_id"] = "https://www.wikidata.org/wiki/" + df_ind[
|
13 |
+
"individual_wikidata_id"
|
14 |
+
].astype(str)
|
15 |
+
|
16 |
+
df_ind = df_ind[df_ind["productive_year"] <= 1800]
|
17 |
+
|
18 |
+
return df_ind
|
19 |
+
|
20 |
+
|
21 |
+
df_ind = load_data()
|
22 |
+
|
23 |
st.title("Our History in Data")
|
24 |
|
25 |
# Set the global index path
|
26 |
global_index_path = "data/immaterial_index/figures_trends_R/results"
|
27 |
+
global_index_path_per_capita = (
|
28 |
+
"data/immaterial_index/figures_trends_R/results_per_capita"
|
29 |
+
)
|
30 |
unseen_index_path = (
|
31 |
"data/immaterial_index/figures_trends_R/figures_unseen/results_unseen"
|
32 |
)
|
|
|
39 |
maps_path = "data/map_figures"
|
40 |
|
41 |
|
42 |
+
from region_list import region_list
|
43 |
+
|
44 |
+
index_paths = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
+
for region_key in region_list:
|
47 |
+
# Create the index paths for the current region
|
48 |
+
index_paths[region_key] = {
|
49 |
+
"map": f"{maps_path}/map_{region_key}.png",
|
50 |
+
"global_index": f"{global_index_path}/{region_key}.png",
|
51 |
+
"global_index_per_capita": f"{global_index_path_per_capita}/{region_key}.png",
|
52 |
+
"unseen_index": f"{unseen_index_path}/{region_key}.png",
|
53 |
+
"unseen_index_capita": f"{unseen_capita_index_path}/{region_key}.png",
|
54 |
+
"population_index": f"{population_path}/{region_key}.png",
|
55 |
+
}
|
56 |
|
57 |
# Get the region names (keys) from the index_paths dictionary
|
58 |
regions = list(index_paths.keys())
|
59 |
|
60 |
# Allow the user to select a region
|
61 |
+
selected_region = st.sidebar.selectbox("Region:", regions, index=regions.index("Japan"))
|
62 |
|
63 |
# Display the selected region's images vertically
|
64 |
if selected_region in index_paths:
|
65 |
+
|
66 |
+
df = df_ind[df_ind["region_name"] == selected_region]
|
67 |
+
df["productive_year"] = round(df["productive_year"], 0)
|
68 |
+
df = df.drop(["region_name", "decade"], axis=1)
|
69 |
+
df = df[
|
70 |
+
[
|
71 |
+
"individual_name",
|
72 |
+
"productive_year",
|
73 |
+
"score",
|
74 |
+
"individual_wikidata_id" "",
|
75 |
+
]
|
76 |
+
]
|
77 |
+
df = df.sort_values("score", ascending=False)
|
78 |
+
df = df.rename(columns={"score": "Number of Catalogs"})
|
79 |
+
df = df.reset_index(drop=True)
|
80 |
+
st.dataframe(df)
|
81 |
+
|
82 |
+
st.write(f"Number of Cultural producers active before 1800: {len(df)}")
|
83 |
+
|
84 |
for key, path in index_paths[selected_region].items():
|
85 |
if os.path.exists(path):
|
86 |
+
|
87 |
if key == "global_index":
|
88 |
st.subheader("Global Index")
|
89 |
st.image(
|
90 |
Image.open(path), caption=key.capitalize(), use_column_width=True
|
91 |
)
|
92 |
+
elif key == "global_index_per_capita":
|
93 |
+
st.subheader("Index per capita")
|
94 |
+
st.image(
|
95 |
+
Image.open(path), caption=key.capitalize(), use_column_width=True
|
96 |
+
)
|
97 |
elif key == "unseen_index":
|
98 |
st.subheader("Unsee-Species Index")
|
99 |
st.image(
|
|
|
105 |
Image.open(path), caption=key.capitalize(), use_column_width=True
|
106 |
)
|
107 |
elif key == "population_index":
|
108 |
+
st.subheader("Population Index")
|
109 |
st.image(
|
110 |
Image.open(path), caption=key.capitalize(), use_column_width=True
|
111 |
)
|
|
|
116 |
)
|
117 |
else:
|
118 |
st.write(f"File for {key.capitalize()} does not exist.")
|
|
|
|
|
|
data/df_individuals_score.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:07747503c90b023c4a239c50a03a44e7f22200e1b15280c3e34b5bf7edb95824
|
3 |
+
size 46515967
|
region_list.py
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
region_list = [
|
2 |
+
"Arabic world",
|
3 |
+
"Japan",
|
4 |
+
"Italy",
|
5 |
+
"mediterranean World",
|
6 |
+
"British Islands",
|
7 |
+
"Arabian peninsula",
|
8 |
+
"Northern India",
|
9 |
+
"South East Asia",
|
10 |
+
"Muslim world",
|
11 |
+
"Greek World",
|
12 |
+
"Central Europe",
|
13 |
+
"Ottoman Turkey",
|
14 |
+
"Chinese world",
|
15 |
+
"German world",
|
16 |
+
"Korea",
|
17 |
+
"Spain",
|
18 |
+
"Greece",
|
19 |
+
"Balkans",
|
20 |
+
"Low countries",
|
21 |
+
"Norway",
|
22 |
+
"Portugal",
|
23 |
+
"Ottoman world",
|
24 |
+
"Yangtze",
|
25 |
+
"Sweden",
|
26 |
+
"France",
|
27 |
+
"Slav world",
|
28 |
+
"Nordic countries",
|
29 |
+
"Indian world",
|
30 |
+
"Latin World",
|
31 |
+
"United Kingdom",
|
32 |
+
"Persian world",
|
33 |
+
"Eastern Europe",
|
34 |
+
"Western Europe",
|
35 |
+
]
|
36 |
+
|
37 |
+
|
38 |
+
full_region_list = [
|
39 |
+
"Southern India",
|
40 |
+
"Arabic world",
|
41 |
+
"Northern France",
|
42 |
+
"Japan",
|
43 |
+
"Austria",
|
44 |
+
"Southern France",
|
45 |
+
"Italy",
|
46 |
+
"Southern Japan",
|
47 |
+
"Northwestern Europe",
|
48 |
+
"mediterranean World",
|
49 |
+
"British Islands",
|
50 |
+
"Denmark",
|
51 |
+
"Arabian peninsula",
|
52 |
+
"Belgium",
|
53 |
+
"Switzerland",
|
54 |
+
"Finland",
|
55 |
+
"Northern India",
|
56 |
+
"South East Asia",
|
57 |
+
"Muslim world",
|
58 |
+
"Greek World",
|
59 |
+
"Central Europe",
|
60 |
+
"Netherlands",
|
61 |
+
"Ottoman Turkey",
|
62 |
+
"Chinese world",
|
63 |
+
"German world",
|
64 |
+
"Ireland",
|
65 |
+
"Korea",
|
66 |
+
"Germany",
|
67 |
+
"Spain",
|
68 |
+
"Greece",
|
69 |
+
"Northern China",
|
70 |
+
"Balkans",
|
71 |
+
"Low countries",
|
72 |
+
"Norway",
|
73 |
+
"Northern Japan",
|
74 |
+
"Portugal",
|
75 |
+
"Northern Italy",
|
76 |
+
"Ottoman world",
|
77 |
+
"Yangtze",
|
78 |
+
"Sweden",
|
79 |
+
"France",
|
80 |
+
"Southern China",
|
81 |
+
"Slav world",
|
82 |
+
"Iceland",
|
83 |
+
"Nordic countries",
|
84 |
+
"Indian world",
|
85 |
+
"Latin World",
|
86 |
+
"Southwestern Europe",
|
87 |
+
"United Kingdom",
|
88 |
+
"Southern Italy",
|
89 |
+
"Persian world",
|
90 |
+
"Eastern Europe",
|
91 |
+
"Western Europe",
|
92 |
+
]
|