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
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
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())