jpdiazpardo's picture
Upload 5 files
b8a333c
raw
history blame
1.06 kB
import plotly.graph_objects as go
def add_emoji(emotions_list):
for s in range(len(emotions_list)):
if emotions_list[s]=="surprise": emotions_list[s]="surprise 😲"
elif emotions_list[s]=="joy": emotions_list[s]="joy πŸ˜€"
elif emotions_list[s]=="anger": emotions_list[s]="anger 🀬"
elif emotions_list[s]=="neutral": emotions_list[s]="neutral 😐"
elif emotions_list[s]=="disgust": emotions_list[s]="disgust 🀒"
elif emotions_list[s]=="fear": emotions_list[s]="fear 😨"
elif emotions_list[s]=="sadness": emotions_list[s]="sadness 😭"
else: print(s)
return emotions_list
def spider_chart(dictionary):
fig = go.Figure(data=go.Scatterpolar(
r=[round(v*100,2) for v in dictionary.values()],
theta= add_emoji([k for k in dictionary.keys()]),
fill='toself'))
fig.update_layout(
polar=dict(
radialaxis=dict(
visible=True
),
),
showlegend=False,
width = 400, height = 400,
title = "Audio Sentiment Analysis", title_x=0.5)
return fig