Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -173,9 +173,13 @@ def generate_audio(script_output, voice1, voice2, num_hosts, temperature, top_p,
|
|
173 |
if len(code_list) < min_length:
|
174 |
code_list = code_list + [0] * (min_length - len(code_list))
|
175 |
|
176 |
-
#
|
177 |
-
codes_tensor = torch.tensor(code_list).unsqueeze(0).to(device)
|
178 |
-
|
|
|
|
|
|
|
|
|
179 |
paragraph_audio = paragraph_audio.cpu().numpy().flatten()
|
180 |
|
181 |
silences = detect_silence(paragraph_audio)
|
|
|
173 |
if len(code_list) < min_length:
|
174 |
code_list = code_list + [0] * (min_length - len(code_list))
|
175 |
|
176 |
+
# Convert to float tensor to match bias type
|
177 |
+
codes_tensor = torch.tensor(code_list, dtype=torch.float32).unsqueeze(0).to(device)
|
178 |
+
|
179 |
+
# Generate audio
|
180 |
+
with torch.no_grad():
|
181 |
+
paragraph_audio = snac_model(codes_tensor)
|
182 |
+
|
183 |
paragraph_audio = paragraph_audio.cpu().numpy().flatten()
|
184 |
|
185 |
silences = detect_silence(paragraph_audio)
|