10zinten commited on
Commit
e8ea911
β€’
1 Parent(s): c54b5f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -9,6 +9,8 @@ from num2tib.core import convert
9
  from num2tib.core import convert2text
10
  import re
11
 
 
 
12
  def replace_numbers_with_convert(sentence, wylie=True):
13
  pattern = r'\d+(\.\d+)?'
14
  def replace(match):
@@ -21,7 +23,7 @@ converter = pyewts.pyewts()
21
  checkpoint = "TenzinGayche/TTS_run3_ep20_174k_b"
22
  processor = SpeechT5Processor.from_pretrained(checkpoint)
23
  model = SpeechT5ForTextToSpeech.from_pretrained(checkpoint)
24
- model.to('cuda')
25
  vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
26
 
27
 
 
9
  from num2tib.core import convert2text
10
  import re
11
 
12
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
13
+
14
  def replace_numbers_with_convert(sentence, wylie=True):
15
  pattern = r'\d+(\.\d+)?'
16
  def replace(match):
 
23
  checkpoint = "TenzinGayche/TTS_run3_ep20_174k_b"
24
  processor = SpeechT5Processor.from_pretrained(checkpoint)
25
  model = SpeechT5ForTextToSpeech.from_pretrained(checkpoint)
26
+ model.to(device)
27
  vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
28
 
29