Skip to content

Commit

Permalink
Style ID指定できるようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
tuna2134 authored Nov 13, 2024
1 parent b414d22 commit 9b9962e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sbv2_api/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ fn length_default() -> f32 {
1.0
}

fn style_id_default() -> f32 {
0
}

#[derive(Deserialize, ToSchema)]
struct SynthesizeRequest {
text: String,
Expand All @@ -48,6 +52,8 @@ struct SynthesizeRequest {
sdp_ratio: f32,
#[serde(default = "length_default")]
length_scale: f32,
#[serde(default = "style_id_default")]
style_id: i32,
}

#[utoipa::path(
Expand All @@ -65,6 +71,7 @@ async fn synthesize(
ident,
sdp_ratio,
length_scale,
style_id
}): Json<SynthesizeRequest>,
) -> AppResult<impl IntoResponse> {
log::debug!("processing request: text={text}, ident={ident}, sdp_ratio={sdp_ratio}, length_scale={length_scale}");
Expand All @@ -73,7 +80,7 @@ async fn synthesize(
tts_model.easy_synthesize(
&ident,
&text,
0,
style_id,
SynthesizeOptions {
sdp_ratio,
length_scale,
Expand Down

0 comments on commit 9b9962e

Please sign in to comment.