Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,7 @@ import plotly.express as px
|
|
| 17 |
import torch
|
| 18 |
#import torch_xla.core.xla_model as xm
|
| 19 |
from pyannote.audio import Pipeline
|
| 20 |
-
from pyannote.core import Annotation, Segment
|
| 21 |
from df.enhance import enhance, init_df
|
| 22 |
import datetime as dt
|
| 23 |
|
|
@@ -226,6 +226,20 @@ for i, tab in enumerate(audio_tabs):
|
|
| 226 |
|
| 227 |
all_dataFrame = su.speakerListToDataFrame(sortedSpeakerList)
|
| 228 |
currDF = all_dataFrame
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
|
| 230 |
# Lecturer vs. Audience
|
| 231 |
#---------------------------------------------------------------------------
|
|
|
|
| 17 |
import torch
|
| 18 |
#import torch_xla.core.xla_model as xm
|
| 19 |
from pyannote.audio import Pipeline
|
| 20 |
+
from pyannote.core import Annotation, Segment, Timeline
|
| 21 |
from df.enhance import enhance, init_df
|
| 22 |
import datetime as dt
|
| 23 |
|
|
|
|
| 226 |
|
| 227 |
all_dataFrame = su.speakerListToDataFrame(sortedSpeakerList)
|
| 228 |
currDF = all_dataFrame
|
| 229 |
+
|
| 230 |
+
multiVoice = annotations.get_overlap()
|
| 231 |
+
singleVoice = annotations.extrude(multiVoice).get_timeline()
|
| 232 |
+
noVoice = Timeline(segments=[Segment[0,totalSeconds]]).extrude(singleVoice).extrude(multiVoice)
|
| 233 |
+
# Pie Categories
|
| 234 |
+
#---------------------------------------------------------------------------
|
| 235 |
+
df = pd.DataFrame(
|
| 236 |
+
{
|
| 237 |
+
"Duration": [noVoice.duration(),singleVoice.duration(),multiVoice.duration()],
|
| 238 |
+
"Category": ["Silence", "Single Voice", "Multiple Voices"],
|
| 239 |
+
}
|
| 240 |
+
)
|
| 241 |
+
fig = px.pie(df, values='Duration', names='Category', title='Types of Discussion')
|
| 242 |
+
tab.plotly_chart(fig, use_container_width=True)
|
| 243 |
|
| 244 |
# Lecturer vs. Audience
|
| 245 |
#---------------------------------------------------------------------------
|