Skip to content

Commit

Permalink
🐛 fix refine api #116
Browse files Browse the repository at this point in the history
- add tests
  • Loading branch information
zhzLuke96 committed Jul 27, 2024
1 parent 3b45772 commit 86ae55a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/core/models/TTSModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def interrupt(self, context: TTSPipelineContext = None) -> None:
pass

def encode(self, text: str) -> list[int]:
return [ord(char) for char in text.split("")]
return [ord(char) for char in text]

def decode(self, ids: list[int]) -> str:
return "".join([chr(id) for id in ids])
Expand Down
2 changes: 1 addition & 1 deletion modules/core/tools/SentenceSplitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def char_tokenizer(text: str):
return [ord(char) for char in text.split("")]
return [ord(char) for char in text]


# 解析文本 并根据停止符号分割成句子
Expand Down
26 changes: 26 additions & 0 deletions tests/api/test_prompt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from pytest import mark


@mark.refine_api
def test_refine_success(client):
response = client.post(
"/v1/prompt/refine",
json={
"text": "你好,世界",
"prompt": "[oral_2][laugh_0][break_6]",
"seed": -1,
"top_P": 0.7,
"top_K": 20,
"temperature": 0.7,
"repetition_penalty": 1,
"max_new_token": 384,
"spliter_threshold": 300,
"normalize": True,
},
)
data = response.json()
assert response.status_code == 200
assert "message" in data
assert data["message"] == "ok"
assert "data" in data
assert isinstance(data["data"], str)

0 comments on commit 86ae55a

Please sign in to comment.