File size: 787 Bytes
32e218a
b84dff6
32e218a
b84dff6
32e218a
b84dff6
 
 
 
2176d40
 
b84dff6
 
 
2176d40
 
 
b84dff6
e30c131
2176d40
b84dff6
 
 
2176d40
b84dff6
32e218a
2176d40
b84dff6
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import gradio as gr
# from TTS.api import TTS

# tts = TTS(model_name="tts_models/multilingual/multi-dataset/your_tts", progress_bar=False, gpu=False)

# def predict(text):
#     file_path = "output.wav"
#     tts.tts_to_file(text, speaker=tts.speakers[0], language="en", file_path=file_path)
#     return file_path

# demo = gr.Interface(
#     fn=predict,
#     inputs='text',
#     outputs='audio'
# )


# demo.launch()


import librosa
import numpy as np
import torch

from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech, SpeechT5HifiGan


checkpoint = "microsoft/speecht5_tts"
processor = SpeechT5Processor.from_pretrained(checkpoint)
model = SpeechT5ForTextToSpeech.from_pretrained(checkpoint)
vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")