Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -46,7 +46,11 @@ def inference(audio_file_path: str, text_p: str, audio_file_path_p: str, text_n:
|
|
46 |
pad = (320000 - (len(mixture) % 320000))if len(mixture) % 320000 != 0 else 0
|
47 |
|
48 |
mixture =torch.tensor(np.pad(mixture,(0,pad)))
|
49 |
-
|
|
|
|
|
|
|
|
|
50 |
mixture_chunks = torch.chunk(mixture, dim=0, chunks=len(mixture)//320000)
|
51 |
sep_segments = []
|
52 |
for chunk in mixture_chunks:
|
|
|
46 |
pad = (320000 - (len(mixture) % 320000))if len(mixture) % 320000 != 0 else 0
|
47 |
|
48 |
mixture =torch.tensor(np.pad(mixture,(0,pad)))
|
49 |
+
|
50 |
+
max_value = torch.max(torch.abs(mixture))
|
51 |
+
if max_value > 1:
|
52 |
+
mixture *= 0.9 / max_value
|
53 |
+
|
54 |
mixture_chunks = torch.chunk(mixture, dim=0, chunks=len(mixture)//320000)
|
55 |
sep_segments = []
|
56 |
for chunk in mixture_chunks:
|