Spaces:
Running
on
Zero
Running
on
Zero
Update webui.py
Browse files
webui.py
CHANGED
|
@@ -27,7 +27,7 @@ from huggingface_hub import snapshot_download
|
|
| 27 |
def initialize_model(model_dir=snapshot_download("SparkAudio/Spark-TTS-0.5B"), device=0):
|
| 28 |
"""Load the model once at the beginning."""
|
| 29 |
logging.info(f"Loading model from: {model_dir}")
|
| 30 |
-
device = torch.device(
|
| 31 |
model = SparkTTS(model_dir, device)
|
| 32 |
return model
|
| 33 |
|
|
@@ -100,7 +100,7 @@ def voice_creation(text, model, gender, pitch, speed):
|
|
| 100 |
def build_ui(model_dir, device=0):
|
| 101 |
with gr.Blocks() as demo:
|
| 102 |
# Initialize model
|
| 103 |
-
model = initialize_model(model_dir, device=
|
| 104 |
# Use HTML for centered title
|
| 105 |
gr.HTML('<h1 style="text-align: center;">Spark-TTS by SparkAudio</h1>')
|
| 106 |
with gr.Tabs():
|
|
|
|
| 27 |
def initialize_model(model_dir=snapshot_download("SparkAudio/Spark-TTS-0.5B"), device=0):
|
| 28 |
"""Load the model once at the beginning."""
|
| 29 |
logging.info(f"Loading model from: {model_dir}")
|
| 30 |
+
device = torch.device("cuda")
|
| 31 |
model = SparkTTS(model_dir, device)
|
| 32 |
return model
|
| 33 |
|
|
|
|
| 100 |
def build_ui(model_dir, device=0):
|
| 101 |
with gr.Blocks() as demo:
|
| 102 |
# Initialize model
|
| 103 |
+
model = initialize_model(model_dir, device="cuda")
|
| 104 |
# Use HTML for centered title
|
| 105 |
gr.HTML('<h1 style="text-align: center;">Spark-TTS by SparkAudio</h1>')
|
| 106 |
with gr.Tabs():
|