Spaces:
Sleeping
Sleeping
Switched to using Sonogram.py
Browse files
app.py
CHANGED
|
@@ -15,11 +15,7 @@ from pathlib import Path
|
|
| 15 |
import streamlit as st
|
| 16 |
import torch
|
| 17 |
import pandas as pd
|
| 18 |
-
from
|
| 19 |
-
from pyannote.audio.pipelines import SpeakerDiarization
|
| 20 |
-
from pyannote.audio.models.segmentation import PyanNet
|
| 21 |
-
from pyannote.audio import Inference
|
| 22 |
-
from pyannote.pipeline.parameter import ParamDict
|
| 23 |
|
| 24 |
import sonogram_utility as su
|
| 25 |
import utils
|
|
@@ -76,25 +72,7 @@ if ENABLE_DENOISE:
|
|
| 76 |
else:
|
| 77 |
dfModel = dfState = None
|
| 78 |
|
| 79 |
-
|
| 80 |
-
pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization-3.1")
|
| 81 |
-
|
| 82 |
-
# Generate replacement segmentation model
|
| 83 |
-
newSpecs = pipeline._segmentation.model.specifications
|
| 84 |
-
segModel = PyanNet.from_pretrained('20251208_Sonogram_Segmentation.ckpt')
|
| 85 |
-
segModel.specifications = newSpecs
|
| 86 |
-
segmentation_duration = segModel.specifications.duration
|
| 87 |
-
|
| 88 |
-
# Update baseline with training
|
| 89 |
-
pipeline._segmentation = Inference(
|
| 90 |
-
segModel,
|
| 91 |
-
duration=segmentation_duration,
|
| 92 |
-
step=pipeline.segmentation_step * segmentation_duration,
|
| 93 |
-
skip_aggregation=True,
|
| 94 |
-
batch_size=1,
|
| 95 |
-
)
|
| 96 |
-
|
| 97 |
-
pipeline.to(device)
|
| 98 |
|
| 99 |
# ---------------------------------------------------------------------------
|
| 100 |
# Session state + global styles
|
|
|
|
| 15 |
import streamlit as st
|
| 16 |
import torch
|
| 17 |
import pandas as pd
|
| 18 |
+
from sonogram import Sonogram
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
import sonogram_utility as su
|
| 21 |
import utils
|
|
|
|
| 72 |
else:
|
| 73 |
dfModel = dfState = None
|
| 74 |
|
| 75 |
+
pipeline = Sonogram()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
# ---------------------------------------------------------------------------
|
| 78 |
# Session state + global styles
|