Skip to content

Commit a519d84

Browse files
authored
ENH: support virtualenv for chattts (#3541)
1 parent 0374f71 commit a519d84

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

xinference/core/media_interface.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import threading
2020
import time
2121
import uuid
22-
from typing import Dict, List, Optional, Tuple, Union
22+
from typing import Any, Dict, List, Optional, Tuple, Union
2323

2424
import gradio as gr
2525
import PIL.Image
@@ -653,13 +653,14 @@ def tts_generate(
653653
with open(prompt_speech_file, "rb") as f:
654654
prompt_speech_bytes = f.read()
655655

656+
kw: Dict[str, Any] = {}
657+
if prompt_speech_bytes:
658+
kw["prompt_speech"] = prompt_speech_bytes
659+
if prompt_text:
660+
kw["prompt_text"] = prompt_text
661+
656662
response = model.speech(
657-
input=input_text,
658-
voice=voice,
659-
speed=speed,
660-
response_format="mp3",
661-
prompt_speech=prompt_speech_bytes,
662-
prompt_text=prompt_text,
663+
input=input_text, voice=voice, speed=speed, response_format="mp3", **kw
663664
)
664665

665666
# Write to a temp .mp3 file and return its path

xinference/model/audio/model_spec.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,14 @@
269269
"model_id": "2Noise/ChatTTS",
270270
"model_revision": "1a3c04a8b0651689bd9242fbb55b1f4b5a9aef84",
271271
"model_ability": ["text2audio"],
272-
"multilingual": true
272+
"multilingual": true,
273+
"virtualenv": {
274+
"packages": [
275+
"ChatTTS>=0.2.1",
276+
"#system_torch#",
277+
"#system_numpy#"
278+
]
279+
}
273280
},
274281
{
275282
"model_name": "CosyVoice-300M",

xinference/model/audio/model_spec_modelscope.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,14 @@
119119
"model_id": "AI-ModelScope/ChatTTS",
120120
"model_revision": "master",
121121
"model_ability": ["text2audio"],
122-
"multilingual": true
122+
"multilingual": true,
123+
"virtualenv": {
124+
"packages": [
125+
"ChatTTS>=0.2.1",
126+
"#system_torch#",
127+
"#system_numpy#"
128+
]
129+
}
123130
},
124131
{
125132
"model_name": "CosyVoice-300M",

0 commit comments

Comments
 (0)