Spaces:
Sleeping
Sleeping
Commit
·
ab57f4a
1
Parent(s):
44955d1
Update app.py
Browse files
app.py
CHANGED
@@ -38,22 +38,6 @@ def generate_story(scenario):
|
|
38 |
print(story)
|
39 |
return story
|
40 |
|
41 |
-
def recite_the_poem(content):
|
42 |
-
processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
|
43 |
-
model = SpeechT5ForTextToSpeech.from_pretrained("microsoft/speecht5_tts")
|
44 |
-
vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
|
45 |
-
|
46 |
-
inputs = processor(text=content, return_tensors="pt")
|
47 |
-
|
48 |
-
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
49 |
-
speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0)
|
50 |
-
|
51 |
-
speech = model.generate_speech(inputs["input_ids"], speaker_embeddings, vocoder=vocoder)
|
52 |
-
|
53 |
-
sf.write("speech.wav", speech.numpy(), samplerate=16000)
|
54 |
-
|
55 |
-
return "speech.wav"
|
56 |
-
|
57 |
def recite_the_poem(content):
|
58 |
processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
|
59 |
model = SpeechT5ForTextToSpeech.from_pretrained("microsoft/speecht5_tts")
|
|
|
38 |
print(story)
|
39 |
return story
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
def recite_the_poem(content):
|
42 |
processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
|
43 |
model = SpeechT5ForTextToSpeech.from_pretrained("microsoft/speecht5_tts")
|