Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import os
|
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
from TTS.api import TTS
|
| 5 |
-
import spaces # Ensure this
|
| 6 |
|
| 7 |
# Agree to Coqui TOS
|
| 8 |
os.environ["COQUI_TOS_AGREED"] = "1"
|
|
@@ -14,7 +14,7 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
| 14 |
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2")
|
| 15 |
tts.to(device)
|
| 16 |
|
| 17 |
-
@spaces.GPU(enable_queue=True
|
| 18 |
def clone(text, audio):
|
| 19 |
output_path = "./output.wav"
|
| 20 |
tts.tts_to_file(text=text, speaker_wav=audio, language="en", file_path=output_path)
|
|
@@ -32,11 +32,28 @@ with gr.Blocks(title="Advanced Voice Clone", theme=gr.themes.Soft(primary_hue="t
|
|
| 32 |
*Non-commercial use only.*
|
| 33 |
|
| 34 |
[Coqui Public Model License](https://coqui.ai/cpml) |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
---
|
| 38 |
"""
|
| 39 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
with gr.Row():
|
| 42 |
with gr.Column(scale=1):
|
|
@@ -74,19 +91,5 @@ with gr.Blocks(title="Advanced Voice Clone", theme=gr.themes.Soft(primary_hue="t
|
|
| 74 |
queue=True
|
| 75 |
)
|
| 76 |
|
| 77 |
-
# Add custom CSS for enhanced styling
|
| 78 |
-
demo.add_css("""
|
| 79 |
-
#audio_upload > label {
|
| 80 |
-
background-color: #14b8a6;
|
| 81 |
-
color: white;
|
| 82 |
-
padding: 10px;
|
| 83 |
-
border-radius: 5px;
|
| 84 |
-
cursor: pointer;
|
| 85 |
-
}
|
| 86 |
-
#audio_upload > label:hover {
|
| 87 |
-
background-color: #0d9488;
|
| 88 |
-
}
|
| 89 |
-
""")
|
| 90 |
-
|
| 91 |
# Launch the app
|
| 92 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
from TTS.api import TTS
|
| 5 |
+
import spaces # Ensure this is the correct module for your environment
|
| 6 |
|
| 7 |
# Agree to Coqui TOS
|
| 8 |
os.environ["COQUI_TOS_AGREED"] = "1"
|
|
|
|
| 14 |
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2")
|
| 15 |
tts.to(device)
|
| 16 |
|
| 17 |
+
@spaces.GPU() # Removed enable_queue=True since it's now always True
|
| 18 |
def clone(text, audio):
|
| 19 |
output_path = "./output.wav"
|
| 20 |
tts.tts_to_file(text=text, speaker_wav=audio, language="en", file_path=output_path)
|
|
|
|
| 32 |
*Non-commercial use only.*
|
| 33 |
|
| 34 |
[Coqui Public Model License](https://coqui.ai/cpml) |
|
| 35 |
+
|
|
|
|
| 36 |
---
|
| 37 |
"""
|
| 38 |
)
|
| 39 |
+
|
| 40 |
+
# Inject custom CSS using Markdown and <style> tags
|
| 41 |
+
gr.Markdown(
|
| 42 |
+
"""
|
| 43 |
+
<style>
|
| 44 |
+
#audio_upload > label {
|
| 45 |
+
background-color: #14b8a6;
|
| 46 |
+
color: white;
|
| 47 |
+
padding: 10px;
|
| 48 |
+
border-radius: 5px;
|
| 49 |
+
cursor: pointer;
|
| 50 |
+
}
|
| 51 |
+
#audio_upload > label:hover {
|
| 52 |
+
background-color: #0d9488;
|
| 53 |
+
}
|
| 54 |
+
</style>
|
| 55 |
+
"""
|
| 56 |
+
)
|
| 57 |
|
| 58 |
with gr.Row():
|
| 59 |
with gr.Column(scale=1):
|
|
|
|
| 91 |
queue=True
|
| 92 |
)
|
| 93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
# Launch the app
|
| 95 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|