edit
Browse files
app.py
CHANGED
@@ -1,11 +1,9 @@
|
|
1 |
import gradio as gr
|
2 |
import numpy as np
|
3 |
import torch
|
4 |
-
import os
|
5 |
from datasets import load_dataset
|
6 |
|
7 |
from transformers import AutoProcessor, SpeechT5ForTextToSpeech, SpeechT5HifiGan, SpeechT5Processor, pipeline
|
8 |
-
os.environ["CUDA_VISIBLE_DEVICES"]="7"
|
9 |
|
10 |
# device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
device = "cpu"
|
@@ -14,10 +12,6 @@ device = "cpu"
|
|
14 |
asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=device)
|
15 |
|
16 |
# load text-to-speech checkpoint and speaker embeddings
|
17 |
-
# processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
|
18 |
-
# model = SpeechT5ForTextToSpeech.from_pretrained("microsoft/speecht5_tts").to(device)
|
19 |
-
# vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan").to(device)
|
20 |
-
|
21 |
processor = SpeechT5Processor.from_pretrained("sanchit-gandhi/speecht5_tts_vox_nl")
|
22 |
model = SpeechT5ForTextToSpeech.from_pretrained("sanchit-gandhi/speecht5_tts_vox_nl")
|
23 |
vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan").to(device)
|
|
|
1 |
import gradio as gr
|
2 |
import numpy as np
|
3 |
import torch
|
|
|
4 |
from datasets import load_dataset
|
5 |
|
6 |
from transformers import AutoProcessor, SpeechT5ForTextToSpeech, SpeechT5HifiGan, SpeechT5Processor, pipeline
|
|
|
7 |
|
8 |
# device = "cuda" if torch.cuda.is_available() else "cpu"
|
9 |
device = "cpu"
|
|
|
12 |
asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=device)
|
13 |
|
14 |
# load text-to-speech checkpoint and speaker embeddings
|
|
|
|
|
|
|
|
|
15 |
processor = SpeechT5Processor.from_pretrained("sanchit-gandhi/speecht5_tts_vox_nl")
|
16 |
model = SpeechT5ForTextToSpeech.from_pretrained("sanchit-gandhi/speecht5_tts_vox_nl")
|
17 |
vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan").to(device)
|