Commit
•
9d75599
1
Parent(s):
e9a7ca3
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
from datasets import load_dataset
|
4 |
-
from transformers import pipeline, SpeechT5HifiGan, SpeechT5ForTextToSpeech
|
5 |
|
6 |
model_id = "Sandiago21/speecht5_finetuned_voxpopuli_it" # update with your model id
|
7 |
# pipe = pipeline("automatic-speech-recognition", model=model_id)
|
@@ -10,6 +10,9 @@ vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
|
|
10 |
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
11 |
speaker_embeddings = torch.tensor(embeddings_dataset[7440]["xvector"]).unsqueeze(0)
|
12 |
|
|
|
|
|
|
|
13 |
def synthesize_speech(text):
|
14 |
inputs = processor(text=text, return_tensors="pt")
|
15 |
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
from datasets import load_dataset
|
4 |
+
from transformers import pipeline, SpeechT5Processor, SpeechT5HifiGan, SpeechT5ForTextToSpeech
|
5 |
|
6 |
model_id = "Sandiago21/speecht5_finetuned_voxpopuli_it" # update with your model id
|
7 |
# pipe = pipeline("automatic-speech-recognition", model=model_id)
|
|
|
10 |
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
11 |
speaker_embeddings = torch.tensor(embeddings_dataset[7440]["xvector"]).unsqueeze(0)
|
12 |
|
13 |
+
checkpoint = "microsoft/speecht5_tts"
|
14 |
+
processor = SpeechT5Processor.from_pretrained(checkpoint)
|
15 |
+
|
16 |
def synthesize_speech(text):
|
17 |
inputs = processor(text=text, return_tensors="pt")
|
18 |
|