ylacombe HF staff commited on
Commit
240b319
1 Parent(s): bddd843

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -88,9 +88,9 @@ def generate_base(subject, setting):
88
 
89
  gr.Info("Generating Audio")
90
  description = "Jenny speaks at an average pace with a calm delivery in a very confined sounding environment with clear audio quality."
91
- story_tokens = prompt_tokenizer(model_input_tokens, return_tensors="pt", padding=True).input_ids.to(device)
92
- description_tokens = description_tokenizer([description for _ in range(len(model_input_tokens))], return_tensors="pt").input_ids.to(device)
93
- speech_output = model.generate(input_ids=description_tokens, prompt_input_ids=story_tokens)
94
  speech_output = [output.cpu().numpy() for output in speech_output]
95
  gr.Info("Generated Audio")
96
  return None, None, {"audio": speech_output, "text": model_input_tokens}
 
88
 
89
  gr.Info("Generating Audio")
90
  description = "Jenny speaks at an average pace with a calm delivery in a very confined sounding environment with clear audio quality."
91
+ story_tokens = prompt_tokenizer(model_input_tokens, return_tensors="pt", padding=True).to(device)
92
+ description_tokens = description_tokenizer([description for _ in range(len(model_input_tokens))], return_tensors="pt").to(device)
93
+ speech_output = model.generate(input_ids=description_tokens.input_ids, prompt_input_ids=story_tokens.input_ids, attention_mask=description_tokens.attention_mask, prompt_attention_mask=story_tokens.attention_mask)
94
  speech_output = [output.cpu().numpy() for output in speech_output]
95
  gr.Info("Generated Audio")
96
  return None, None, {"audio": speech_output, "text": model_input_tokens}