Laura Wagner commited on
Commit
239055a
·
1 Parent(s): 832b890

add stuff

Browse files
README.md CHANGED
@@ -12,7 +12,8 @@ CIVITAI_VISUALIZATIONS/
12
  │ ├── subset1/
13
  │ ├── subset2/
14
  │ └── ...
15
- ├── misc/ # Miscellaneous scripts and utilities
 
16
  ├── plots/ # Generated plots and visualizations
17
  ├── scripts/ # Jupyter notebooks for analysis
18
  │ ├── 0_Scraping_image_metadata.ipynb # Scraping scripts interacting with the CivitAI API, dataset consolidation
 
12
  │ ├── subset1/
13
  │ ├── subset2/
14
  │ └── ...
15
+ ├── misc/
16
+ │ ├── credentials/ # store api keys (CivitAI, Deepseek) etc. here
17
  ├── plots/ # Generated plots and visualizations
18
  ├── scripts/ # Jupyter notebooks for analysis
19
  │ ├── 0_Scraping_image_metadata.ipynb # Scraping scripts interacting with the CivitAI API, dataset consolidation
public/json/sunburst_countries.json ADDED
@@ -0,0 +1,468 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "root",
3
+ "children": [
4
+ {
5
+ "name": "Australia",
6
+ "children": [
7
+ {
8
+ "name": "Actor",
9
+ "value": 64
10
+ },
11
+ {
12
+ "name": "Adult Performer",
13
+ "value": 3
14
+ },
15
+ {
16
+ "name": "Model",
17
+ "value": 27
18
+ },
19
+ {
20
+ "name": "Online Personality",
21
+ "value": 3
22
+ },
23
+ {
24
+ "name": "Singer, Musician",
25
+ "value": 7
26
+ },
27
+ {
28
+ "name": "Other",
29
+ "value": 11
30
+ }
31
+ ]
32
+ },
33
+ {
34
+ "name": "Brazil",
35
+ "children": [
36
+ {
37
+ "name": "Actor",
38
+ "value": 38
39
+ },
40
+ {
41
+ "name": "Adult Performer",
42
+ "value": 10
43
+ },
44
+ {
45
+ "name": "Model",
46
+ "value": 29
47
+ },
48
+ {
49
+ "name": "Online Personality",
50
+ "value": 12
51
+ },
52
+ {
53
+ "name": "Singer, Musician",
54
+ "value": 9
55
+ },
56
+ {
57
+ "name": "Other",
58
+ "value": 14
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "name": "Canada",
64
+ "children": [
65
+ {
66
+ "name": "Actor",
67
+ "value": 96
68
+ },
69
+ {
70
+ "name": "Adult Performer",
71
+ "value": 19
72
+ },
73
+ {
74
+ "name": "Model",
75
+ "value": 15
76
+ },
77
+ {
78
+ "name": "Online Personality",
79
+ "value": 15
80
+ },
81
+ {
82
+ "name": "Singer, Musician",
83
+ "value": 20
84
+ },
85
+ {
86
+ "name": "Voice Actor",
87
+ "value": 2
88
+ },
89
+ {
90
+ "name": "Other",
91
+ "value": 12
92
+ }
93
+ ]
94
+ },
95
+ {
96
+ "name": "China",
97
+ "children": [
98
+ {
99
+ "name": "Actor",
100
+ "value": 145
101
+ },
102
+ {
103
+ "name": "Adult Performer",
104
+ "value": 2
105
+ },
106
+ {
107
+ "name": "Model",
108
+ "value": 10
109
+ },
110
+ {
111
+ "name": "Online Personality",
112
+ "value": 8
113
+ },
114
+ {
115
+ "name": "Singer, Musician",
116
+ "value": 27
117
+ },
118
+ {
119
+ "name": "Voice Actor",
120
+ "value": 2
121
+ },
122
+ {
123
+ "name": "Other",
124
+ "value": 19
125
+ }
126
+ ]
127
+ },
128
+ {
129
+ "name": "France",
130
+ "children": [
131
+ {
132
+ "name": "Actor",
133
+ "value": 41
134
+ },
135
+ {
136
+ "name": "Adult Performer",
137
+ "value": 12
138
+ },
139
+ {
140
+ "name": "Model",
141
+ "value": 11
142
+ },
143
+ {
144
+ "name": "Online Personality",
145
+ "value": 5
146
+ },
147
+ {
148
+ "name": "Singer, Musician",
149
+ "value": 13
150
+ },
151
+ {
152
+ "name": "Other",
153
+ "value": 26
154
+ }
155
+ ]
156
+ },
157
+ {
158
+ "name": "Germany",
159
+ "children": [
160
+ {
161
+ "name": "Actor",
162
+ "value": 26
163
+ },
164
+ {
165
+ "name": "Adult Performer",
166
+ "value": 16
167
+ },
168
+ {
169
+ "name": "Model",
170
+ "value": 27
171
+ },
172
+ {
173
+ "name": "Online Personality",
174
+ "value": 16
175
+ },
176
+ {
177
+ "name": "Singer, Musician",
178
+ "value": 11
179
+ },
180
+ {
181
+ "name": "Other",
182
+ "value": 32
183
+ }
184
+ ]
185
+ },
186
+ {
187
+ "name": "India",
188
+ "children": [
189
+ {
190
+ "name": "Actor",
191
+ "value": 127
192
+ },
193
+ {
194
+ "name": "Adult Performer",
195
+ "value": 2
196
+ },
197
+ {
198
+ "name": "Model",
199
+ "value": 8
200
+ },
201
+ {
202
+ "name": "Online Personality",
203
+ "value": 3
204
+ },
205
+ {
206
+ "name": "Singer, Musician",
207
+ "value": 3
208
+ },
209
+ {
210
+ "name": "Other",
211
+ "value": 3
212
+ }
213
+ ]
214
+ },
215
+ {
216
+ "name": "Indonesia",
217
+ "children": [
218
+ {
219
+ "name": "Actor",
220
+ "value": 15
221
+ },
222
+ {
223
+ "name": "Adult Performer",
224
+ "value": 5
225
+ },
226
+ {
227
+ "name": "Model",
228
+ "value": 13
229
+ },
230
+ {
231
+ "name": "Online Personality",
232
+ "value": 19
233
+ },
234
+ {
235
+ "name": "Singer, Musician",
236
+ "value": 25
237
+ },
238
+ {
239
+ "name": "Other",
240
+ "value": 3
241
+ }
242
+ ]
243
+ },
244
+ {
245
+ "name": "Japan",
246
+ "children": [
247
+ {
248
+ "name": "Actor",
249
+ "value": 145
250
+ },
251
+ {
252
+ "name": "Adult Performer",
253
+ "value": 371
254
+ },
255
+ {
256
+ "name": "Model",
257
+ "value": 52
258
+ },
259
+ {
260
+ "name": "Online Personality",
261
+ "value": 6
262
+ },
263
+ {
264
+ "name": "Singer, Musician",
265
+ "value": 482
266
+ },
267
+ {
268
+ "name": "Voice Actor",
269
+ "value": 297
270
+ },
271
+ {
272
+ "name": "Other",
273
+ "value": 67
274
+ }
275
+ ]
276
+ },
277
+ {
278
+ "name": "Other",
279
+ "children": [
280
+ {
281
+ "name": "Actor",
282
+ "value": 380
283
+ },
284
+ {
285
+ "name": "Adult Performer",
286
+ "value": 184
287
+ },
288
+ {
289
+ "name": "Model",
290
+ "value": 308
291
+ },
292
+ {
293
+ "name": "Online Personality",
294
+ "value": 145
295
+ },
296
+ {
297
+ "name": "Singer, Musician",
298
+ "value": 151
299
+ },
300
+ {
301
+ "name": "Voice Actor",
302
+ "value": 6
303
+ },
304
+ {
305
+ "name": "Other",
306
+ "value": 318
307
+ }
308
+ ]
309
+ },
310
+ {
311
+ "name": "Russia",
312
+ "children": [
313
+ {
314
+ "name": "Actor",
315
+ "value": 47
316
+ },
317
+ {
318
+ "name": "Adult Performer",
319
+ "value": 89
320
+ },
321
+ {
322
+ "name": "Model",
323
+ "value": 73
324
+ },
325
+ {
326
+ "name": "Online Personality",
327
+ "value": 22
328
+ },
329
+ {
330
+ "name": "Singer, Musician",
331
+ "value": 24
332
+ },
333
+ {
334
+ "name": "Voice Actor",
335
+ "value": 3
336
+ },
337
+ {
338
+ "name": "Other",
339
+ "value": 41
340
+ }
341
+ ]
342
+ },
343
+ {
344
+ "name": "South Korea",
345
+ "children": [
346
+ {
347
+ "name": "Actor",
348
+ "value": 85
349
+ },
350
+ {
351
+ "name": "Adult Performer",
352
+ "value": 1
353
+ },
354
+ {
355
+ "name": "Model",
356
+ "value": 14
357
+ },
358
+ {
359
+ "name": "Online Personality",
360
+ "value": 3
361
+ },
362
+ {
363
+ "name": "Singer, Musician",
364
+ "value": 405
365
+ },
366
+ {
367
+ "name": "Other",
368
+ "value": 9
369
+ }
370
+ ]
371
+ },
372
+ {
373
+ "name": "Ukraine",
374
+ "children": [
375
+ {
376
+ "name": "Actor",
377
+ "value": 13
378
+ },
379
+ {
380
+ "name": "Adult Performer",
381
+ "value": 26
382
+ },
383
+ {
384
+ "name": "Model",
385
+ "value": 35
386
+ },
387
+ {
388
+ "name": "Online Personality",
389
+ "value": 6
390
+ },
391
+ {
392
+ "name": "Singer, Musician",
393
+ "value": 8
394
+ },
395
+ {
396
+ "name": "Other",
397
+ "value": 9
398
+ }
399
+ ]
400
+ },
401
+ {
402
+ "name": "United Kingdom",
403
+ "children": [
404
+ {
405
+ "name": "Actor",
406
+ "value": 253
407
+ },
408
+ {
409
+ "name": "Adult Performer",
410
+ "value": 13
411
+ },
412
+ {
413
+ "name": "Model",
414
+ "value": 31
415
+ },
416
+ {
417
+ "name": "Online Personality",
418
+ "value": 16
419
+ },
420
+ {
421
+ "name": "Singer, Musician",
422
+ "value": 45
423
+ },
424
+ {
425
+ "name": "Voice Actor",
426
+ "value": 2
427
+ },
428
+ {
429
+ "name": "Other",
430
+ "value": 65
431
+ }
432
+ ]
433
+ },
434
+ {
435
+ "name": "United States",
436
+ "children": [
437
+ {
438
+ "name": "Actor",
439
+ "value": 1041
440
+ },
441
+ {
442
+ "name": "Adult Performer",
443
+ "value": 894
444
+ },
445
+ {
446
+ "name": "Model",
447
+ "value": 204
448
+ },
449
+ {
450
+ "name": "Online Personality",
451
+ "value": 219
452
+ },
453
+ {
454
+ "name": "Singer, Musician",
455
+ "value": 168
456
+ },
457
+ {
458
+ "name": "Voice Actor",
459
+ "value": 36
460
+ },
461
+ {
462
+ "name": "Other",
463
+ "value": 289
464
+ }
465
+ ]
466
+ }
467
+ ]
468
+ }
public/json/sunburst_countries_A.json ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "root",
3
+ "children": [
4
+ {
5
+ "name": "Australia",
6
+ "children": [
7
+ {
8
+ "name": "Actor",
9
+ "value": 1
10
+ }
11
+ ]
12
+ },
13
+ {
14
+ "name": "China",
15
+ "children": [
16
+ {
17
+ "name": "Actor",
18
+ "value": 1
19
+ }
20
+ ]
21
+ },
22
+ {
23
+ "name": "Colombia",
24
+ "children": [
25
+ {
26
+ "name": "Actor",
27
+ "value": 1
28
+ }
29
+ ]
30
+ },
31
+ {
32
+ "name": "Czechia",
33
+ "children": [
34
+ {
35
+ "name": "Voice Actor",
36
+ "value": 1
37
+ }
38
+ ]
39
+ },
40
+ {
41
+ "name": "Denmark",
42
+ "children": [
43
+ {
44
+ "name": "Actor",
45
+ "value": 1
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "name": "Germany",
51
+ "children": [
52
+ {
53
+ "name": "Online Personality",
54
+ "value": 1
55
+ }
56
+ ]
57
+ },
58
+ {
59
+ "name": "India",
60
+ "children": [
61
+ {
62
+ "name": "Actor",
63
+ "value": 1
64
+ }
65
+ ]
66
+ },
67
+ {
68
+ "name": "Italy",
69
+ "children": [
70
+ {
71
+ "name": "Other",
72
+ "value": 1
73
+ }
74
+ ]
75
+ },
76
+ {
77
+ "name": "Japan",
78
+ "children": [
79
+ {
80
+ "name": "Voice Actor",
81
+ "value": 1
82
+ }
83
+ ]
84
+ },
85
+ {
86
+ "name": "Other",
87
+ "children": [
88
+ {
89
+ "name": "Singer, Musician",
90
+ "value": 1
91
+ },
92
+ {
93
+ "name": "Other",
94
+ "value": 2
95
+ }
96
+ ]
97
+ },
98
+ {
99
+ "name": "Poland",
100
+ "children": [
101
+ {
102
+ "name": "Actor",
103
+ "value": 1
104
+ }
105
+ ]
106
+ },
107
+ {
108
+ "name": "US",
109
+ "children": [
110
+ {
111
+ "name": "Actor",
112
+ "value": 2
113
+ },
114
+ {
115
+ "name": "Adult Performer",
116
+ "value": 2
117
+ },
118
+ {
119
+ "name": "Online Personality",
120
+ "value": 3
121
+ },
122
+ {
123
+ "name": "Singer, Musician",
124
+ "value": 1
125
+ }
126
+ ]
127
+ }
128
+ ]
129
+ }
scripts/01_prepare_sankey_csv.ipynb CHANGED
@@ -9,13 +9,12 @@
9
  },
10
  {
11
  "cell_type": "code",
12
- "execution_count": 1,
13
  "metadata": {},
14
  "outputs": [],
15
  "source": [
16
  "import pandas as pd\n",
17
  "from pathlib import Path\n",
18
- "\n",
19
  "current_dir = Path.cwd()"
20
  ]
21
  },
@@ -45,6 +44,8 @@
45
  }
46
  ],
47
  "source": [
 
 
48
  "df = pd.read_csv(\"data/CSV/all_models_with_tags.csv\", nrows=40000)\n",
49
  "\n",
50
  "\n",
 
9
  },
10
  {
11
  "cell_type": "code",
12
+ "execution_count": null,
13
  "metadata": {},
14
  "outputs": [],
15
  "source": [
16
  "import pandas as pd\n",
17
  "from pathlib import Path\n",
 
18
  "current_dir = Path.cwd()"
19
  ]
20
  },
 
44
  }
45
  ],
46
  "source": [
47
+ "import pandas as pd\n",
48
+ "# Load your dataset\n",
49
  "df = pd.read_csv(\"data/CSV/all_models_with_tags.csv\", nrows=40000)\n",
50
  "\n",
51
  "\n",
scripts/{05_countries_professions_victims.ipynb → Section_3-3-4_Figure_8_deepfake_victims.ipynb} RENAMED
@@ -2,7 +2,7 @@
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
- "execution_count": 1,
6
  "metadata": {},
7
  "outputs": [
8
  {
@@ -17,12 +17,16 @@
17
  "import pandas as pd\n",
18
  "from collections import defaultdict\n",
19
  "import json\n",
 
20
  "\n",
21
- "# Load the dataset\n",
22
- "df = pd.read_csv(\"/home/lauhp/000_PHD/000_000_RESEARCH/000_X_Research_phase_1/d3js/data/model_subsets/POI/countries_professions.csv\")\n",
23
  "\n",
24
- "# ---- Step 1: Limit to top 10 countries ----\n",
25
- "# Force 'Unknown' and empty countries to 'Other' before computing top countries\n",
 
 
 
 
26
  "df['country_cleaned'] = df['country'].apply(lambda x: x if x not in ['Unknown', '', None] else 'Other')\n",
27
  "\n",
28
  "# Now get top countries excluding what was forced into 'Other'\n",
@@ -68,9 +72,10 @@
68
  " sunburst_dict[\"children\"].append({\"name\": country, \"children\": professions})\n",
69
  "\n",
70
  "# ---- Step 5: Save to a JSON file ----\n",
71
- "with open(\"public/json/sunburst_data.json\", \"w\", encoding='utf-8') as f:\n",
72
  " json.dump(sunburst_dict, f, ensure_ascii=False, indent=2)\n",
73
  "\n",
 
74
  "print(\"✅ Sunburst data saved to sunburst_data.json\")\n"
75
  ]
76
  },
 
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
+ "execution_count": 5,
6
  "metadata": {},
7
  "outputs": [
8
  {
 
17
  "import pandas as pd\n",
18
  "from collections import defaultdict\n",
19
  "import json\n",
20
+ "from pathlib import Path\n",
21
  "\n",
22
+ "current_dir = Path.cwd()\n",
 
23
  "\n",
24
+ "sunburst_path = current_dir.parent / \"public/json/sunburst_countries_A.json\"\n",
25
+ "\n",
26
+ "\n",
27
+ "aggregated_poi = current_dir.parent / \"data/CSV/Deepseek_annotated_POI_aggregated.csv\"\n",
28
+ "\n",
29
+ "df = pd.read_csv(aggregated_poi)\n",
30
  "df['country_cleaned'] = df['country'].apply(lambda x: x if x not in ['Unknown', '', None] else 'Other')\n",
31
  "\n",
32
  "# Now get top countries excluding what was forced into 'Other'\n",
 
72
  " sunburst_dict[\"children\"].append({\"name\": country, \"children\": professions})\n",
73
  "\n",
74
  "# ---- Step 5: Save to a JSON file ----\n",
75
+ "with open(sunburst_path, \"w\", encoding='utf-8') as f:\n",
76
  " json.dump(sunburst_dict, f, ensure_ascii=False, indent=2)\n",
77
  "\n",
78
+ "\n",
79
  "print(\"✅ Sunburst data saved to sunburst_data.json\")\n"
80
  ]
81
  },