Spaces:
Sleeping
Sleeping
Update app.py
#2
by
ylacombe
HF staff
- opened
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).
|
92 |
-
description_tokens = description_tokenizer([description for _ in range(len(model_input_tokens))], return_tensors="pt").
|
93 |
-
|
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}
|