cocktailpeanut commited on
Commit
886cf85
1 Parent(s): f961a56
Files changed (2) hide show
  1. app.py +7 -1
  2. requirements.txt +3 -3
app.py CHANGED
@@ -4,7 +4,13 @@ os.system('python -m unidic download')
4
  from melo.api import TTS
5
  speed = 1.0
6
  import tempfile
7
- device = 'cuda' if torch.cuda.is_available() else 'cpu'
 
 
 
 
 
 
8
  model = TTS(language='EN', device=device)
9
  speaker_ids = model.hps.data.spk2id
10
  def synthesize(speaker, text, speed=1.0, progress=gr.Progress()):
 
4
  from melo.api import TTS
5
  speed = 1.0
6
  import tempfile
7
+ if torch.cuda.is_available():
8
+ device = "cuda"
9
+ elif torch.backends.mps.is_available():
10
+ device = "mps"
11
+ else:
12
+ device = "cpu"
13
+ #device = 'cuda' if torch.cuda.is_available() else 'cpu'
14
  model = TTS(language='EN', device=device)
15
  speaker_ids = model.hps.data.spk2id
16
  def synthesize(speaker, text, speed=1.0, progress=gr.Progress()):
requirements.txt CHANGED
@@ -1,6 +1,6 @@
1
  tqdm
2
- torch<2.0
3
- torchaudio
4
  transformers==4.27.4
5
  mecab-python3==1.0.5
6
  num2words==0.5.12
@@ -24,4 +24,4 @@ cn2an==0.5.22
24
  jieba==0.42.1
25
  gradio==3.48.0
26
  langid==1.1.6
27
- txtsplit
 
1
  tqdm
2
+ #torch<2.0
3
+ #torchaudio
4
  transformers==4.27.4
5
  mecab-python3==1.0.5
6
  num2words==0.5.12
 
24
  jieba==0.42.1
25
  gradio==3.48.0
26
  langid==1.1.6
27
+ txtsplit