Spaces:
Runtime error
Runtime error
Update watermarking.py
Browse files- watermarking.py +5 -1
watermarking.py
CHANGED
|
@@ -32,7 +32,11 @@ def watermark(
|
|
| 32 |
watermark_key: list[int],
|
| 33 |
) -> tuple[torch.Tensor, int]:
|
| 34 |
audio_array_44khz = torchaudio.functional.resample(audio_array, orig_freq=sample_rate, new_freq=44100)
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
output_sample_rate = min(44100, sample_rate)
|
| 37 |
encoded = torchaudio.functional.resample(encoded, orig_freq=44100, new_freq=output_sample_rate)
|
| 38 |
return encoded, output_sample_rate
|
|
|
|
| 32 |
watermark_key: list[int],
|
| 33 |
) -> tuple[torch.Tensor, int]:
|
| 34 |
audio_array_44khz = torchaudio.functional.resample(audio_array, orig_freq=sample_rate, new_freq=44100)
|
| 35 |
+
|
| 36 |
+
# Fix the syntax error by properly unpacking the return values
|
| 37 |
+
result = watermarker.encode_wav(audio_array_44khz, 44100, watermark_key, calc_sdr=False, message_sdr=36)
|
| 38 |
+
encoded = result[0] # Assuming the first element is the encoded audio
|
| 39 |
+
|
| 40 |
output_sample_rate = min(44100, sample_rate)
|
| 41 |
encoded = torchaudio.functional.resample(encoded, orig_freq=44100, new_freq=output_sample_rate)
|
| 42 |
return encoded, output_sample_rate
|