Ability to run the Coqui TTS extension on the CPU (#5365)

This commit is contained in:
Hubert Kasperek 2024-01-27 21:15:34 +01:00 committed by GitHub
parent 828be63f2c
commit 69622930c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,6 +3,7 @@ import json
import os
import random
import time
import torch
from pathlib import Path
import gradio as gr
@ -23,7 +24,7 @@ params = {
"voice": "female_01.wav",
"language": "English",
"model_name": "tts_models/multilingual/multi-dataset/xtts_v2",
"device": "cuda"
"device": "cuda" if torch.cuda.is_available() else "cpu"
}
this_dir = str(Path(__file__).parent.resolve())