Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,34 +1,24 @@
|
|
| 1 |
-
import spaces
|
| 2 |
import gradio as gr
|
| 3 |
-
import torch
|
| 4 |
from TTS.api import TTS
|
| 5 |
import os
|
|
|
|
| 6 |
os.environ["COQUI_TOS_AGREED"] = "1"
|
| 7 |
|
| 8 |
-
|
| 9 |
-
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
|
| 10 |
|
| 11 |
def clone(text, audio):
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
---
|
| 23 |
-
|
| 24 |
-
### If you like voice clone then try [Video Face Swap](https://huggingface.co/spaces/tonyassi/video-face-swap)!
|
| 25 |
-
|
| 26 |
-
---
|
| 27 |
|
| 28 |
-
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
theme=gr.themes.Base(primary_hue="teal",secondary_hue="teal",neutral_hue="slate")
|
| 33 |
-
)
|
| 34 |
-
iface.launch()
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from TTS.api import TTS
|
| 3 |
import os
|
| 4 |
+
|
| 5 |
os.environ["COQUI_TOS_AGREED"] = "1"
|
| 6 |
|
| 7 |
+
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to("cpu")
|
|
|
|
| 8 |
|
| 9 |
def clone(text, audio):
|
| 10 |
+
output_path = "./output.wav"
|
| 11 |
+
tts.tts_to_file(text=text, speaker_wav=audio, language="en", file_path=output_path)
|
| 12 |
+
return output_path
|
| 13 |
+
|
| 14 |
+
iface = gr.Interface(
|
| 15 |
+
fn=clone,
|
| 16 |
+
inputs=[gr.Textbox(label="Text"), gr.Audio(type="filepath", label="Voice Reference")],
|
| 17 |
+
outputs=gr.Audio(type="filepath")
|
| 18 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
# Launch and capture the interface info
|
| 21 |
+
server, _, _ = iface.launch(server_name="0.0.0.0", server_port=7860, share=True)
|
| 22 |
|
| 23 |
+
# Print the public shareable URL
|
| 24 |
+
print(f"Gradio link: {server.local_url} / {server.share_url}")
|
|
|
|
|
|
|
|
|