Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,8 +13,8 @@ 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 |
-
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")
|
@@ -41,7 +41,7 @@ def generate_prompt(instruction, input=None):
|
|
41 |
def evaluate(
|
42 |
# instruction,
|
43 |
audio,
|
44 |
-
upload,
|
45 |
input=None,
|
46 |
token_count=200,
|
47 |
temperature=1.0,
|
@@ -107,13 +107,13 @@ def evaluate(
|
|
107 |
|
108 |
res.append(out_str.strip())
|
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
|
117 |
|
118 |
# yield out_str.strip()
|
119 |
|
@@ -122,7 +122,7 @@ g = gr.Interface(
|
|
122 |
inputs=[
|
123 |
# gr.components.Textbox(lines=2, label="Instruction", value="Tell me about ravens."),
|
124 |
gr.Audio(source="microphone", label = "请开始对话吧!", type="filepath"),
|
125 |
-
gr.Audio(source="upload", label = "请上传您喜欢的声音(wav文件)", type="filepath"),
|
126 |
gr.components.Textbox(lines=2, label="Input", placeholder="none"),
|
127 |
gr.components.Slider(minimum=10, maximum=200, step=10, value=150), # token_count
|
128 |
gr.components.Slider(minimum=0.2, maximum=2.0, step=0.1, value=1.0), # temperature
|
@@ -139,7 +139,7 @@ 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!",
|
|
|
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")
|
|
|
41 |
def evaluate(
|
42 |
# instruction,
|
43 |
audio,
|
44 |
+
# upload,
|
45 |
input=None,
|
46 |
token_count=200,
|
47 |
temperature=1.0,
|
|
|
107 |
|
108 |
res.append(out_str.strip())
|
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]
|
117 |
|
118 |
# yield out_str.strip()
|
119 |
|
|
|
122 |
inputs=[
|
123 |
# gr.components.Textbox(lines=2, label="Instruction", value="Tell me about ravens."),
|
124 |
gr.Audio(source="microphone", label = "请开始对话吧!", type="filepath"),
|
125 |
+
# gr.Audio(source="upload", label = "请上传您喜欢的声音(wav文件)", type="filepath"),
|
126 |
gr.components.Textbox(lines=2, label="Input", placeholder="none"),
|
127 |
gr.components.Slider(minimum=10, maximum=200, step=10, value=150), # token_count
|
128 |
gr.components.Slider(minimum=0.2, maximum=2.0, step=0.1, value=1.0), # temperature
|
|
|
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!",
|