Update app.py
Browse files
app.py
CHANGED
|
@@ -128,10 +128,19 @@ if uploaded_file:
|
|
| 128 |
|
| 129 |
# 1. Diarization with Manual Config Loading
|
| 130 |
try:
|
| 131 |
-
# Fix for PyTorch 2.6+ security
|
| 132 |
try:
|
| 133 |
-
|
| 134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
pass
|
| 136 |
|
| 137 |
# Download config.yaml manually to bypass Pipeline.from_pretrained argument issues
|
|
@@ -141,8 +150,8 @@ if uploaded_file:
|
|
| 141 |
token=ACTIVE_HF_TOKEN
|
| 142 |
)
|
| 143 |
|
| 144 |
-
# Load pipeline from the local config file
|
| 145 |
-
pipeline = Pipeline.from_pretrained(config_path)
|
| 146 |
|
| 147 |
if torch.cuda.is_available():
|
| 148 |
pipeline.to(torch.device("cuda"))
|
|
|
|
| 128 |
|
| 129 |
# 1. Diarization with Manual Config Loading
|
| 130 |
try:
|
| 131 |
+
# Fix for PyTorch 2.6+ security - add ALL required safe globals
|
| 132 |
try:
|
| 133 |
+
from pyannote.audio.core.task import Specifications
|
| 134 |
+
from pyannote.audio.core.model import Model
|
| 135 |
+
from pyannote.audio.pipelines.speaker_diarization import SpeakerDiarization
|
| 136 |
+
|
| 137 |
+
torch.serialization.add_safe_globals([
|
| 138 |
+
torch.torch_version.TorchVersion,
|
| 139 |
+
Specifications,
|
| 140 |
+
Model,
|
| 141 |
+
SpeakerDiarization
|
| 142 |
+
])
|
| 143 |
+
except (AttributeError, ImportError):
|
| 144 |
pass
|
| 145 |
|
| 146 |
# Download config.yaml manually to bypass Pipeline.from_pretrained argument issues
|
|
|
|
| 150 |
token=ACTIVE_HF_TOKEN
|
| 151 |
)
|
| 152 |
|
| 153 |
+
# Load pipeline from the local config file with weights_only=False for trust
|
| 154 |
+
pipeline = Pipeline.from_pretrained(config_path, use_auth_token=ACTIVE_HF_TOKEN)
|
| 155 |
|
| 156 |
if torch.cuda.is_available():
|
| 157 |
pipeline.to(torch.device("cuda"))
|