kevinwang676 commited on
Commit
f7854ba
·
verified ·
1 Parent(s): fb728ed

Update cosyvoice/cli/cosyvoice.py

Browse files
Files changed (1) hide show
  1. cosyvoice/cli/cosyvoice.py +4 -0
cosyvoice/cli/cosyvoice.py CHANGED
@@ -18,6 +18,8 @@ from modelscope import snapshot_download
18
  from cosyvoice.cli.frontend import CosyVoiceFrontEnd
19
  from cosyvoice.cli.model import CosyVoiceModel
20
 
 
 
21
  class CosyVoice:
22
 
23
  def __init__(self, model_dir):
@@ -52,6 +54,7 @@ class CosyVoice:
52
  tts_speeches.append(model_output['tts_speech'])
53
  return {'tts_speech': torch.concat(tts_speeches, dim=1)}
54
 
 
55
  def inference_zero_shot(self, tts_text, prompt_text, prompt_speech_16k):
56
  prompt_text = self.frontend.text_normalize(prompt_text, split=False)
57
  tts_speeches = []
@@ -61,6 +64,7 @@ class CosyVoice:
61
  tts_speeches.append(model_output['tts_speech'])
62
  return {'tts_speech': torch.concat(tts_speeches, dim=1)}
63
 
 
64
  def inference_cross_lingual(self, tts_text, prompt_speech_16k):
65
  if self.frontend.instruct is True:
66
  raise ValueError('{} do not support cross_lingual inference'.format(self.model_dir))
 
18
  from cosyvoice.cli.frontend import CosyVoiceFrontEnd
19
  from cosyvoice.cli.model import CosyVoiceModel
20
 
21
+ import spaces
22
+
23
  class CosyVoice:
24
 
25
  def __init__(self, model_dir):
 
54
  tts_speeches.append(model_output['tts_speech'])
55
  return {'tts_speech': torch.concat(tts_speeches, dim=1)}
56
 
57
+ @spaces.GPU
58
  def inference_zero_shot(self, tts_text, prompt_text, prompt_speech_16k):
59
  prompt_text = self.frontend.text_normalize(prompt_text, split=False)
60
  tts_speeches = []
 
64
  tts_speeches.append(model_output['tts_speech'])
65
  return {'tts_speech': torch.concat(tts_speeches, dim=1)}
66
 
67
+ @spaces.GPU
68
  def inference_cross_lingual(self, tts_text, prompt_speech_16k):
69
  if self.frontend.instruct is True:
70
  raise ValueError('{} do not support cross_lingual inference'.format(self.model_dir))