Skip to content

Commit

Permalink
default load config from ./config.json
Browse files Browse the repository at this point in the history
  • Loading branch information
L-jasmine committed Jan 17, 2025
1 parent 7790eb8 commit f076799
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ anyhow = "1.0.87"
wav_io = "0.1.14"
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
gpt_sovits_rs = { version = "0.3.1" }
gpt_sovits_rs = { version = "0.3.2" }
log = "0.4"
env_logger = "0.11"

Expand Down
2 changes: 0 additions & 2 deletions download_model.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,5 @@ cat > config.json << EOF
}
EOF

echo "export GPT_SOVITS_CONFIG_PATH=$(pwd)/config.json"
echo "export GPT_SOVITS_DICT_PATH=$(pwd)"
echo "# run tts-api-server"
echo "wasmedge --dir .:. tts-api-server.wasm --model-name gpt_sovits --model gpt_sovits --config NA --espeak-ng-dir NA"
3 changes: 2 additions & 1 deletion src/tts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ pub struct GPTSovitsRuntime {

impl GPTSovitsRuntime {
pub fn new_by_env() -> anyhow::Result<Self> {
let config_path = std::env::var("GPT_SOVITS_CONFIG_PATH")?;
let config_path =
std::env::var("GPT_SOVITS_CONFIG_PATH").unwrap_or("config.json".to_string());
let config = std::fs::read_to_string(config_path)?;
let config: Config = serde_json::from_str(&config)?;
Self::new(&config)
Expand Down

0 comments on commit f076799

Please sign in to comment.