Spaces:
Runtime error
Runtime error
Delete visualizer.py
Browse files- visualizer.py +0 -74
visualizer.py
DELETED
|
@@ -1,74 +0,0 @@
|
|
| 1 |
-
import plotly.graph_objects as go
|
| 2 |
-
from typing import Dict
|
| 3 |
-
|
| 4 |
-
def create_emotion_plot(emotions: Dict[str, float]) -> str:
|
| 5 |
-
"""Create emotion distribution plot"""
|
| 6 |
-
fig = go.Figure()
|
| 7 |
-
|
| 8 |
-
# Add bar plot
|
| 9 |
-
fig.add_trace(go.Bar(
|
| 10 |
-
x=list(emotions.keys()),
|
| 11 |
-
y=list(emotions.values()),
|
| 12 |
-
marker_color='rgb(55, 83, 109)'
|
| 13 |
-
))
|
| 14 |
-
|
| 15 |
-
# Update layout
|
| 16 |
-
fig.update_layout(
|
| 17 |
-
title='Emotion Distribution',
|
| 18 |
-
xaxis_title='Emotion',
|
| 19 |
-
yaxis_title='Score',
|
| 20 |
-
yaxis_range=[0, 1],
|
| 21 |
-
template='plotly_white',
|
| 22 |
-
height=400
|
| 23 |
-
)
|
| 24 |
-
|
| 25 |
-
return fig.to_html(include_plotlyjs=True)
|
| 26 |
-
|
| 27 |
-
def create_pitch_plot(pitch_data: Dict) -> str:
|
| 28 |
-
"""Create pitch analysis plot"""
|
| 29 |
-
fig = go.Figure()
|
| 30 |
-
|
| 31 |
-
# Add box plot
|
| 32 |
-
fig.add_trace(go.Box(
|
| 33 |
-
y=[pitch_data['min'], pitch_data['mean'], pitch_data['max']],
|
| 34 |
-
name='Pitch Distribution',
|
| 35 |
-
boxpoints='all'
|
| 36 |
-
))
|
| 37 |
-
|
| 38 |
-
# Update layout
|
| 39 |
-
fig.update_layout(
|
| 40 |
-
title='Pitch Analysis',
|
| 41 |
-
yaxis_title='Frequency (Hz)',
|
| 42 |
-
template='plotly_white',
|
| 43 |
-
height=400
|
| 44 |
-
)
|
| 45 |
-
|
| 46 |
-
return fig.to_html(include_plotlyjs=True)
|
| 47 |
-
|
| 48 |
-
def create_energy_plot(energy_data: Dict) -> str:
|
| 49 |
-
"""Create energy analysis plot"""
|
| 50 |
-
fig = go.Figure()
|
| 51 |
-
|
| 52 |
-
# Add indicator
|
| 53 |
-
fig.add_trace(go.Indicator(
|
| 54 |
-
mode='gauge+number',
|
| 55 |
-
value=energy_data['mean'],
|
| 56 |
-
title={'text': 'Voice Energy Level'},
|
| 57 |
-
gauge={
|
| 58 |
-
'axis': {'range': [0, 1]},
|
| 59 |
-
'bar': {'color': 'darkblue'},
|
| 60 |
-
'steps': [
|
| 61 |
-
{'range': [0, 0.3], 'color': 'lightgray'},
|
| 62 |
-
{'range': [0.3, 0.7], 'color': 'gray'},
|
| 63 |
-
{'range': [0.7, 1], 'color': 'darkgray'}
|
| 64 |
-
]
|
| 65 |
-
}
|
| 66 |
-
))
|
| 67 |
-
|
| 68 |
-
# Update layout
|
| 69 |
-
fig.update_layout(
|
| 70 |
-
height=300,
|
| 71 |
-
template='plotly_white'
|
| 72 |
-
)
|
| 73 |
-
|
| 74 |
-
return fig.to_html(include_plotlyjs=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|