Spaces:
Runtime error
Runtime error
Update visualization.py
Browse files- visualization.py +4 -6
visualization.py
CHANGED
|
@@ -9,8 +9,6 @@ def create_charts(results):
|
|
| 9 |
charts[speaker_id] = {}
|
| 10 |
explanations[speaker_id] = {}
|
| 11 |
|
| 12 |
-
# Extract the actual name from the speaker_id
|
| 13 |
-
|
| 14 |
# Attachment Styles
|
| 15 |
attachment_data = data['attachments']
|
| 16 |
labels = ['Secured', 'Anxious-Preoccupied', 'Dismissive-Avoidant', 'Fearful-Avoidant']
|
|
@@ -21,7 +19,7 @@ def create_charts(results):
|
|
| 21 |
colors = ['blue', 'orange', 'green', 'red']
|
| 22 |
|
| 23 |
fig = go.Figure(data=[go.Bar(x=labels, y=values, marker_color=colors)])
|
| 24 |
-
fig.update_layout(title=f'
|
| 25 |
charts[speaker_id]['attachment'] = fig
|
| 26 |
explanations[speaker_id]['attachment'] = attachment_data.Explanation
|
| 27 |
|
|
@@ -33,7 +31,7 @@ def create_charts(results):
|
|
| 33 |
colors = ['blue', 'green', 'red', 'purple', 'orange']
|
| 34 |
|
| 35 |
fig = go.Figure(data=[go.Bar(x=labels, y=values, marker_color=colors)])
|
| 36 |
-
fig.update_layout(title=f'
|
| 37 |
charts[speaker_id]['bigfive'] = fig
|
| 38 |
explanations[speaker_id]['bigfive'] = bigfive_data.Explanation
|
| 39 |
|
|
@@ -49,7 +47,7 @@ def create_charts(results):
|
|
| 49 |
colors = ['black', 'orange', 'gray', 'green', 'brown', 'purple', 'red', 'cyan', 'gold']
|
| 50 |
|
| 51 |
fig = go.Figure(data=[go.Bar(x=labels, y=values, marker_color=colors)])
|
| 52 |
-
fig.update_layout(title=f'
|
| 53 |
charts[speaker_id]['personality'] = fig
|
| 54 |
explanations[speaker_id]['personality'] = personality_data.Explanation
|
| 55 |
|
|
@@ -69,7 +67,7 @@ def create_charts(results):
|
|
| 69 |
radialaxis=dict(visible=True, range=[0, 10])
|
| 70 |
),
|
| 71 |
showlegend=False,
|
| 72 |
-
title=f'
|
| 73 |
)
|
| 74 |
charts[speaker_id]['dimensions'] = fig
|
| 75 |
|
|
|
|
| 9 |
charts[speaker_id] = {}
|
| 10 |
explanations[speaker_id] = {}
|
| 11 |
|
|
|
|
|
|
|
| 12 |
# Attachment Styles
|
| 13 |
attachment_data = data['attachments']
|
| 14 |
labels = ['Secured', 'Anxious-Preoccupied', 'Dismissive-Avoidant', 'Fearful-Avoidant']
|
|
|
|
| 19 |
colors = ['blue', 'orange', 'green', 'red']
|
| 20 |
|
| 21 |
fig = go.Figure(data=[go.Bar(x=labels, y=values, marker_color=colors)])
|
| 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 |
|
|
|
|
| 31 |
colors = ['blue', 'green', 'red', 'purple', 'orange']
|
| 32 |
|
| 33 |
fig = go.Figure(data=[go.Bar(x=labels, y=values, marker_color=colors)])
|
| 34 |
+
fig.update_layout(title=f'{speaker_id}: Big Five Traits', yaxis_range=[0, 10])
|
| 35 |
charts[speaker_id]['bigfive'] = fig
|
| 36 |
explanations[speaker_id]['bigfive'] = bigfive_data.Explanation
|
| 37 |
|
|
|
|
| 47 |
colors = ['black', 'orange', 'gray', 'green', 'brown', 'purple', 'red', 'cyan', 'gold']
|
| 48 |
|
| 49 |
fig = go.Figure(data=[go.Bar(x=labels, y=values, marker_color=colors)])
|
| 50 |
+
fig.update_layout(title=f'{speaker_id}: Personality Disorders', yaxis_range=[0, 5])
|
| 51 |
charts[speaker_id]['personality'] = fig
|
| 52 |
explanations[speaker_id]['personality'] = personality_data.Explanation
|
| 53 |
|
|
|
|
| 67 |
radialaxis=dict(visible=True, range=[0, 10])
|
| 68 |
),
|
| 69 |
showlegend=False,
|
| 70 |
+
title=f'{speaker_id}: Attachment Dimensions'
|
| 71 |
)
|
| 72 |
charts[speaker_id]['dimensions'] = fig
|
| 73 |
|