diff --git a/run.py b/run.py index 56a95e294..b04afc11d 100644 --- a/run.py +++ b/run.py @@ -10,7 +10,6 @@ from typing import List, Optional import numpy as np -import pyworld as pw import soundfile import uvicorn from fastapi import FastAPI, HTTPException, Request, Response @@ -129,6 +128,8 @@ def create_accent_phrases(text: str, speaker_id: int) -> List[AccentPhrase]: def synthesis_world_params( query: AudioQuery, base_speaker: int, target_speaker: int ): + import pyworld as pw + base_wave = engine.synthesis(query=query, speaker_id=base_speaker).astype( "float" ) @@ -404,6 +405,8 @@ def synthesis_morphing( モーフィングの割合は`morph_rate`で指定でき、0.0でベースの話者、1.0でターゲットの話者に近づきます。 """ + import pyworld as pw + if morph_rate < 0.0 or morph_rate > 1.0: raise HTTPException( status_code=422, detail="morph_rateは0.0から1.0の範囲で指定してください"