Spaces:
Build error
Build error
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -44,43 +44,6 @@ def split(text):
|
|
| 44 |
sentences = [s.strip() for s in sentences]
|
| 45 |
return sentences
|
| 46 |
|
| 47 |
-
def create_fig(x_min, x_max, to_plot, plot_sentences):
|
| 48 |
-
x, y = list(zip(*to_plot))
|
| 49 |
-
|
| 50 |
-
x_min -= 5
|
| 51 |
-
x_max += 5
|
| 52 |
-
|
| 53 |
-
plot_df = pd.DataFrame(
|
| 54 |
-
data={
|
| 55 |
-
"x": x,
|
| 56 |
-
"y": y,
|
| 57 |
-
"sentence": plot_sentences,
|
| 58 |
-
}
|
| 59 |
-
)
|
| 60 |
-
|
| 61 |
-
fig = px.line(
|
| 62 |
-
plot_df,
|
| 63 |
-
x="x",
|
| 64 |
-
y="y",
|
| 65 |
-
hover_data={
|
| 66 |
-
"sentence": True,
|
| 67 |
-
"x": True,
|
| 68 |
-
"y": False,
|
| 69 |
-
},
|
| 70 |
-
labels={"x": "time (seconds)", "y": "sentiment"},
|
| 71 |
-
title=f"Customer sentiment over time",
|
| 72 |
-
markers=True,
|
| 73 |
-
)
|
| 74 |
-
|
| 75 |
-
fig = fig.update_yaxes(categoryorder="category ascending")
|
| 76 |
-
fig = fig.update_layout(
|
| 77 |
-
font=dict(
|
| 78 |
-
size=18,
|
| 79 |
-
),
|
| 80 |
-
xaxis_range=[x_min, x_max],
|
| 81 |
-
)
|
| 82 |
-
|
| 83 |
-
return fig
|
| 84 |
|
| 85 |
def speech_to_text(speech_file, speaker_segmentation, whisper, alignment_model, metadata, whisper_device):
|
| 86 |
speaker_output = speaker_segmentation(speech_file)
|
|
|
|
| 44 |
sentences = [s.strip() for s in sentences]
|
| 45 |
return sentences
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
def speech_to_text(speech_file, speaker_segmentation, whisper, alignment_model, metadata, whisper_device):
|
| 49 |
speaker_output = speaker_segmentation(speech_file)
|