bluenevus commited on
Commit
52d788a
·
verified ·
1 Parent(s): 0b2e588

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -167,6 +167,12 @@ def generate_audio(script_output, voice1, voice2, num_hosts, temperature, top_p,
167
  )
168
 
169
  code_list = parse_output(generated_ids)
 
 
 
 
 
 
170
  # Use the correct method for audio generation based on your SNAC model
171
  codes_tensor = torch.tensor(code_list).unsqueeze(0).to(device)
172
  paragraph_audio = snac_model(codes_tensor)
 
167
  )
168
 
169
  code_list = parse_output(generated_ids)
170
+
171
+ # Ensure the code list is long enough (at least 7 elements)
172
+ min_length = 7
173
+ if len(code_list) < min_length:
174
+ code_list = code_list + [0] * (min_length - len(code_list))
175
+
176
  # Use the correct method for audio generation based on your SNAC model
177
  codes_tensor = torch.tensor(code_list).unsqueeze(0).to(device)
178
  paragraph_audio = snac_model(codes_tensor)