Spaces:
Runtime error
Runtime error
Update visualization.py
Browse files- visualization.py +15 -1
visualization.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
import plotly.graph_objs as go
|
2 |
-
from plotly.subplots import make_subplots
|
3 |
|
4 |
def create_charts(results):
|
5 |
charts = {}
|
@@ -37,6 +36,21 @@ def create_charts(results):
|
|
37 |
charts[speaker_id]['bigfive'] = fig
|
38 |
explanations[speaker_id]['bigfive'] = bigfive_data.explanation
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
# Attachment Dimensions (Radar Chart)
|
42 |
dimensions_data = data['attachments']
|
|
|
1 |
import plotly.graph_objs as go
|
|
|
2 |
|
3 |
def create_charts(results):
|
4 |
charts = {}
|
|
|
36 |
charts[speaker_id]['bigfive'] = fig
|
37 |
explanations[speaker_id]['bigfive'] = bigfive_data.explanation
|
38 |
|
39 |
+
# Personality Disorders
|
40 |
+
personality_data = data['personalities']
|
41 |
+
labels = ['Depressed', 'Paranoid', 'Schizoid-Schizotypal', 'Antisocial-Psychopathic',
|
42 |
+
'Borderline-Dysregulated', 'Narcissistic', 'Anxious-Avoidant', 'Dependent-Victimized', 'Obsessional']
|
43 |
+
values = [personality_data.depressed, personality_data.paranoid,
|
44 |
+
personality_data.schizoid_schizotypal, personality_data.antisocial_psychopathic,
|
45 |
+
personality_data.borderline_dysregulated, personality_data.narcissistic,
|
46 |
+
personality_data.anxious_avoidant, personality_data.dependent_victimized,
|
47 |
+
personality_data.obsessional]
|
48 |
+
colors = ['gray', 'purple', 'gold', 'black', 'red', 'orange', 'green', 'cyan', 'brown']
|
49 |
+
|
50 |
+
fig = go.Figure(data=[go.Bar(x=labels, y=values, marker_color=colors)])
|
51 |
+
fig.update_layout(title=f'{speaker_id}: Personality Disorders', yaxis_range=[0, 5])
|
52 |
+
charts[speaker_id]['personality'] = fig
|
53 |
+
explanations[speaker_id]['personality'] = personality_data.explanation
|
54 |
|
55 |
# Attachment Dimensions (Radar Chart)
|
56 |
dimensions_data = data['attachments']
|