mirror of
https://github.com/neodyland/sbv2-api.git
synced 2025-12-22 23:49:58 +00:00
fix
This commit is contained in:
@@ -41,7 +41,7 @@ pub struct TTSModelHolder {
|
||||
tokenizer: Tokenizer,
|
||||
bert: Session,
|
||||
models: Vec<TTSModel>,
|
||||
jtalk: jtalk::JTalk,
|
||||
pub jtalk: jtalk::JTalk,
|
||||
max_loaded_models: Option<usize>,
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,13 @@ struct ResponseCreateAudioQuery {
|
||||
}
|
||||
|
||||
async fn create_audio_query(
|
||||
State(state): State<AppState>,
|
||||
Query(request): Query<RequestCreateAudioQuery>,
|
||||
) -> AppResult<impl IntoResponse> {
|
||||
let (text, process) = preprocess_parse_text(&request.text, &JTalk::new()?)?;
|
||||
let (text, process) = {
|
||||
let mut tts_model = state.tts_model.lock().await;
|
||||
preprocess_parse_text(&request.text, &tts_model.jtalk)?
|
||||
};
|
||||
let kana_tone_list = process.g2kana_tone()?;
|
||||
let audio_query = kana_tone_list
|
||||
.iter()
|
||||
|
||||
19
test.py
Normal file
19
test.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import requests
|
||||
|
||||
|
||||
data = (requests.get("http://localhost:8080/audio_query", params={
|
||||
"text": "こんにちは",
|
||||
})).json()
|
||||
print(data)
|
||||
|
||||
data = (requests.post("http://localhost:8080/synthesis", json={
|
||||
"text": "こんにちは",
|
||||
"ident": "tsukuyomi",
|
||||
"speaker_id": 0,
|
||||
"style_id": 0,
|
||||
"sdp_ratio": 0.5,
|
||||
"length_scale": 0.5,
|
||||
"audio_query": data["audio_query"],
|
||||
})).content
|
||||
with open("test.wav", "wb") as f:
|
||||
f.write(data)
|
||||
Reference in New Issue
Block a user