Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -49,9 +49,16 @@ doge_generation_config = GenerationConfig(
|
|
49 |
|
50 |
# Load and pad/truncate speaker embedding to exactly 600 dimensions
|
51 |
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
def process_image(image):
|
57 |
try:
|
|
|
49 |
|
50 |
# Load and pad/truncate speaker embedding to exactly 600 dimensions
|
51 |
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
52 |
+
raw_vec = embeddings_dataset[0]["xvector"]
|
53 |
+
|
54 |
+
# Force embedding to 600 dimensions
|
55 |
+
if len(raw_vec) > 600:
|
56 |
+
raw_vec = raw_vec[:600]
|
57 |
+
elif len(raw_vec) < 600:
|
58 |
+
raw_vec = raw_vec + [0.0] * (600 - len(raw_vec))
|
59 |
+
|
60 |
+
speaker_embedding = torch.tensor(raw_vec, dtype=torch.float32).unsqueeze(0) # shape [1, 600]
|
61 |
+
assert speaker_embedding.shape == (1, 600), f"Speaker embedding shape is {speaker_embedding.shape}, expected (1, 600)"
|
62 |
|
63 |
def process_image(image):
|
64 |
try:
|