Spaces:
Runtime error
Runtime error
Update visualization.py
Browse files- visualization.py +22 -25
visualization.py
CHANGED
@@ -18,10 +18,9 @@ def create_charts(results):
|
|
18 |
values = [attachment_data.secured, attachment_data.anxious_preoccupied,
|
19 |
attachment_data.dismissive_avoidant, attachment_data.fearful_avoidant]
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
}
|
25 |
explanations[speaker_id]['attachment'] = attachment_data.explanation
|
26 |
|
27 |
# Big Five Traits
|
@@ -30,10 +29,9 @@ def create_charts(results):
|
|
30 |
values = [bigfive_data.extraversion, bigfive_data.agreeableness,
|
31 |
bigfive_data.conscientiousness, bigfive_data.neuroticism, bigfive_data.openness]
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
}
|
37 |
explanations[speaker_id]['bigfive'] = bigfive_data.explanation
|
38 |
|
39 |
# Personality Disorders
|
@@ -46,10 +44,9 @@ def create_charts(results):
|
|
46 |
personality_data.anxious_avoidant, personality_data.dependent_victimized,
|
47 |
personality_data.obsessional]
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
}
|
53 |
explanations[speaker_id]['personality'] = personality_data.explanation
|
54 |
|
55 |
# Attachment Dimensions (Radar Chart)
|
@@ -58,18 +55,18 @@ def create_charts(results):
|
|
58 |
values = [dimensions_data.self_model, dimensions_data.others_model,
|
59 |
dimensions_data.anxiety, dimensions_data.avoidance]
|
60 |
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
|
75 |
return charts, explanations, general_impressions
|
|
|
18 |
values = [attachment_data.secured, attachment_data.anxious_preoccupied,
|
19 |
attachment_data.dismissive_avoidant, attachment_data.fearful_avoidant]
|
20 |
|
21 |
+
fig = go.Figure(data=[go.Bar(x=labels, y=values)])
|
22 |
+
fig.update_layout(title=f'{speaker_id}: Attachment Styles', yaxis_range=[0, 1])
|
23 |
+
charts[speaker_id]['attachment'] = fig
|
|
|
24 |
explanations[speaker_id]['attachment'] = attachment_data.explanation
|
25 |
|
26 |
# Big Five Traits
|
|
|
29 |
values = [bigfive_data.extraversion, bigfive_data.agreeableness,
|
30 |
bigfive_data.conscientiousness, bigfive_data.neuroticism, bigfive_data.openness]
|
31 |
|
32 |
+
fig = go.Figure(data=[go.Bar(x=labels, y=values)])
|
33 |
+
fig.update_layout(title=f'{speaker_id}: Big Five Traits', yaxis_range=[0, 10])
|
34 |
+
charts[speaker_id]['bigfive'] = fig
|
|
|
35 |
explanations[speaker_id]['bigfive'] = bigfive_data.explanation
|
36 |
|
37 |
# Personality Disorders
|
|
|
44 |
personality_data.anxious_avoidant, personality_data.dependent_victimized,
|
45 |
personality_data.obsessional]
|
46 |
|
47 |
+
fig = go.Figure(data=[go.Bar(x=labels, y=values)])
|
48 |
+
fig.update_layout(title=f'{speaker_id}: Personality Disorders', yaxis_range=[0, 5])
|
49 |
+
charts[speaker_id]['personality'] = fig
|
|
|
50 |
explanations[speaker_id]['personality'] = personality_data.explanation
|
51 |
|
52 |
# Attachment Dimensions (Radar Chart)
|
|
|
55 |
values = [dimensions_data.self_model, dimensions_data.others_model,
|
56 |
dimensions_data.anxiety, dimensions_data.avoidance]
|
57 |
|
58 |
+
fig = go.Figure(data=go.Scatterpolar(
|
59 |
+
r=values,
|
60 |
+
theta=labels,
|
61 |
+
fill='toself'
|
62 |
+
))
|
63 |
+
fig.update_layout(
|
64 |
+
polar=dict(
|
65 |
+
radialaxis=dict(visible=True, range=[0, 10])
|
66 |
+
),
|
67 |
+
showlegend=False,
|
68 |
+
title=f'{speaker_id}: Attachment Dimensions'
|
69 |
+
)
|
70 |
+
charts[speaker_id]['dimensions'] = fig
|
71 |
|
72 |
return charts, explanations, general_impressions
|