ayymen commited on
Commit
2c32692
1 Parent(s): e95bc25

Only use CUDA if available

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -2,6 +2,9 @@ import gradio as gr
2
  import tempfile
3
  from TTS.utils.synthesizer import Synthesizer
4
  from huggingface_hub import hf_hub_download
 
 
 
5
 
6
  REPO_ID = "ayymen/Coqui-TTS-Vits-shi"
7
 
@@ -28,7 +31,7 @@ def tts(text: str):
28
  synthesizer = Synthesizer(
29
  best_model_path,
30
  config_path,
31
- use_cuda=True
32
  )
33
 
34
  # create audio file
 
2
  import tempfile
3
  from TTS.utils.synthesizer import Synthesizer
4
  from huggingface_hub import hf_hub_download
5
+ import torch
6
+
7
+ CUDA = torch.cuda.is_available()
8
 
9
  REPO_ID = "ayymen/Coqui-TTS-Vits-shi"
10
 
 
31
  synthesizer = Synthesizer(
32
  best_model_path,
33
  config_path,
34
+ use_cuda=CUDA
35
  )
36
 
37
  # create audio file