Spaces:
Runtime error
Runtime error
File size: 1,057 Bytes
7b2e448 d52a468 b30d2c3 d52a468 7b2e448 b30d2c3 7b2e448 b30d2c3 7b2e448 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
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 |