Spaces:
Runtime error
Runtime error
File size: 2,364 Bytes
3f53728 a13c70d 11fdcf5 b71f9c2 86127fd b71f9c2 86127fd b71f9c2 86127fd 11fdcf5 9f6ab8e 11fdcf5 a13c70d 3f53728 a13c70d 11fdcf5 a13c70d d8bfda7 09f90bb 5d8ec27 09f90bb 5d8ec27 09f90bb 824e11d 41aeb60 010e837 b91090f ef8c193 a13c70d |
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
import spaces
import gradio as gr
import torch
from TTS.api import TTS
import os
#from TTS.tts.configs.xtts_config import XttsConfig
from functools import partial
# 기존 torch.load 함수에서 weights_only=False를 기본값으로 설정
torch.load = partial(torch.load, weights_only=False)
print("-----xxxx-----")
#print(XttsConfig)
# 안전한 글로벌 목록에 XttsConfig를 추가
#torch.serialization.add_safe_globals([XttsConfig])
os.environ["COQUI_TOS_AGREED"] = "1"
device = "cuda"
device = "cpu"
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
@spaces.GPU(enable_queue=True)
def clone(text, audio):
tts.tts_to_file(text=text, speaker_wav=audio, language="en", file_path="./output.wav")
return "./output.wav"
iface = gr.Interface(fn=clone,
inputs=[gr.Textbox(label='Text'),gr.Audio(type='filepath', label='Voice reference audio file')],
outputs=gr.Audio(type='filepath'),
title='Voice Clone',
description="""
by [Tony Assi](https://www.tonyassi.com/)
This space uses xtts_v2 model. Non-commercial use only. [Coqui Public Model License](https://coqui.ai/cpml)
Please ❤️ this Space. <a href="mailto: tony.assi.media@gmail.com">Email me</a>.
""",
theme = gr.themes.Base(primary_hue="teal",secondary_hue="teal",neutral_hue="slate"),
examples=[["Hey! It's me Dorthy, from the Wizard of Oz. Type in whatever you'd like me to say.","./audio/Wizard-of-Oz-Dorthy.wav"],
["It's me Vito Corleone, from the Godfather. Type in whatever you'd like me to say.","./audio/Godfather.wav"],
["Hey, it's me Paris Hilton. Type in whatever you'd like me to say.","./audio/Paris-Hilton.mp3"],
["Hey, it's me Megan Fox from Transformers. Type in whatever you'd like me to say.","./audio/Megan-Fox.mp3"],
["Hey there, it's me Jeff Goldblum. Type in whatever you'd like me to say.","./audio/Jeff-Goldblum.mp3"],
["Hey there, it's me Heath Ledger as the Joker. Type in whatever you'd like me to say.","./audio/Heath-Ledger.mp3"],])
iface.launch() |