Kevin676 commited on
Commit
6e3fd02
1 Parent(s): 088ea2e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -17
app.py CHANGED
@@ -13,22 +13,9 @@ title1 = "RWKV-4-Raven-7B-v8-Eng-20230408-ctx4096"
13
  os.environ["RWKV_JIT_ON"] = '1'
14
  os.environ["RWKV_CUDA_ON"] = '1' # if '1' then use CUDA kernel for seq mode (much faster)
15
 
16
- os.system('pip install voicefixer --upgrade')
17
- from voicefixer import VoiceFixer
18
- voicefixer = VoiceFixer()
19
-
20
  from TTS.api import TTS
21
  tts = TTS(model_name="tts_models/multilingual/multi-dataset/your_tts", progress_bar=False, gpu=True)
22
 
23
- import torchaudio
24
- from speechbrain.pretrained import SpectralMaskEnhancement
25
-
26
- enhance_model = SpectralMaskEnhancement.from_hparams(
27
- source="speechbrain/metricgan-plus-voicebank",
28
- savedir="pretrained_models/metricgan-plus-voicebank",
29
- run_opts={"device":"cuda"},
30
- )
31
-
32
  from rwkv.model import RWKV
33
  model_path = hf_hub_download(repo_id="BlinkDL/rwkv-4-raven", filename=f"{title1}.pth")
34
  model = RWKV(model=model_path, strategy='cuda fp16i8 *8 -> cuda fp16')
@@ -122,10 +109,12 @@ def evaluate(
122
 
123
  res1 = ' '.join(str(x) for x in res)
124
 
125
-
126
- return [result.text, res]
 
 
 
127
 
128
- # return [result.text, res, "enhanced.wav"]
129
  # yield out_str.strip()
130
 
131
  g = gr.Interface(
@@ -150,7 +139,7 @@ g = gr.Interface(
150
  lines=5,
151
  label="Raven Output",
152
  ),
153
- # gr.Audio(label="Audio with Custom Voice"),
154
  ],
155
  title="🥳💬💕 - TalktoAI,随时随地,谈天说地!",
156
  description="🤖 - 让有人文关怀的AI造福每一个人!AI向善,文明璀璨!TalktoAI - Enable the future!",
 
13
  os.environ["RWKV_JIT_ON"] = '1'
14
  os.environ["RWKV_CUDA_ON"] = '1' # if '1' then use CUDA kernel for seq mode (much faster)
15
 
 
 
 
 
16
  from TTS.api import TTS
17
  tts = TTS(model_name="tts_models/multilingual/multi-dataset/your_tts", progress_bar=False, gpu=True)
18
 
 
 
 
 
 
 
 
 
 
19
  from rwkv.model import RWKV
20
  model_path = hf_hub_download(repo_id="BlinkDL/rwkv-4-raven", filename=f"{title1}.pth")
21
  model = RWKV(model=model_path, strategy='cuda fp16i8 *8 -> cuda fp16')
 
109
 
110
  res1 = ' '.join(str(x) for x in res)
111
 
112
+ tts.tts_to_file(res1, speaker_wav = upload, language="en", file_path="output.wav")
113
+
114
+ # return [result.text, res]
115
+
116
+ return [result.text, res, "output.wav"]
117
 
 
118
  # yield out_str.strip()
119
 
120
  g = gr.Interface(
 
139
  lines=5,
140
  label="Raven Output",
141
  ),
142
+ gr.Audio(label="Audio with Custom Voice"),
143
  ],
144
  title="🥳💬💕 - TalktoAI,随时随地,谈天说地!",
145
  description="🤖 - 让有人文关怀的AI造福每一个人!AI向善,文明璀璨!TalktoAI - Enable the future!",