|
import gradio as gr |
|
|
|
|
|
|
|
from huggingface_hub import snapshot_download |
|
|
|
|
|
|
|
|
|
model_ids = [ |
|
'suno/bark', |
|
] |
|
for model_id in model_ids: |
|
model_name = model_id.split('/')[-1] |
|
snapshot_download(model_id, local_dir=f'checkpoints/{model_name}') |
|
|
|
|
|
|
|
from TTS.tts.configs.bark_config import BarkConfig |
|
from TTS.tts.models.bark import Bark |
|
|
|
config = BarkConfig() |
|
model = Bark.init_from_config(config) |
|
model.load_checkpoint(config, checkpoint_dir="checkpoints/bark", eval=True) |
|
|
|
def infer(prompt): |
|
|
|
text = "Hello, my name is Manmay , how are you?" |
|
|
|
|
|
|
|
|
|
|
|
|
|
output_dict = model.synthesize(text, config, speaker_id="speaker", voice_dirs="bark_voices/") |
|
|
|
return "done" |
|
|
|
gr.Interface(fn=infer, inputs=[gr.Textbox()], outputs=[gr.Textbox()]).launch() |