From b0f8a4c7d17ee9d84c9415d40c03a60c01ea5fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Mon, 17 Apr 2023 20:49:29 +0800 Subject: [PATCH] fix: json format (#84) * Update extract_locale.py * Apply Code Formatter Change * Update locale_diff.py * Apply Code Formatter Change --------- Co-authored-by: fumiama --- extract_locale.py | 1 + gui.py | 3 ++- i18n/locale_diff.py | 1 + infer-web.py | 13 +++++++++++-- trainset_preprocess_pipeline_print.py | 2 +- vc_infer_pipeline.py | 4 +++- 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/extract_locale.py b/extract_locale.py index 546335b..c42bda5 100644 --- a/extract_locale.py +++ b/extract_locale.py @@ -28,3 +28,4 @@ process("gui.py") # Save as a JSON file with open("./i18n/zh_CN.json", "w", encoding="utf-8") as f: json.dump(data, f, ensure_ascii=False, indent=4) + f.write("\n") diff --git a/gui.py b/gui.py index 24fcf1e..db9a8d6 100644 --- a/gui.py +++ b/gui.py @@ -1,4 +1,5 @@ -import os,sys +import os, sys + now_dir = os.getcwd() sys.path.append(now_dir) import PySimpleGUI as sg diff --git a/i18n/locale_diff.py b/i18n/locale_diff.py index 6419266..2572779 100644 --- a/i18n/locale_diff.py +++ b/i18n/locale_diff.py @@ -42,3 +42,4 @@ for lang_file in languages: # Save the updated language file with open(lang_file, "w", encoding="utf-8") as f: json.dump(lang_data, f, ensure_ascii=False, indent=4) + f.write("\n") diff --git a/infer-web.py b/infer-web.py index 00d55b2..b027f0e 100644 --- a/infer-web.py +++ b/infer-web.py @@ -139,8 +139,17 @@ def vc_single( if hubert_model == None: load_hubert() if_f0 = cpt.get("f0", 1) - file_index = file_index.strip(" ").strip('"').strip("\n").strip('"').strip(" ").replace("trained","added")#防止小白写错,自动帮他替换掉 - file_big_npy = file_big_npy.strip(" ").strip('"').strip("\n").strip('"').strip(" ") + file_index = ( + file_index.strip(" ") + .strip('"') + .strip("\n") + .strip('"') + .strip(" ") + .replace("trained", "added") + ) # 防止小白写错,自动帮他替换掉 + file_big_npy = ( + file_big_npy.strip(" ").strip('"').strip("\n").strip('"').strip(" ") + ) audio_opt = vc.pipeline( hubert_model, net_g, diff --git a/trainset_preprocess_pipeline_print.py b/trainset_preprocess_pipeline_print.py index 5167c82..caaf533 100644 --- a/trainset_preprocess_pipeline_print.py +++ b/trainset_preprocess_pipeline_print.py @@ -39,7 +39,7 @@ class PreProcess: max_sil_kept=150, ) self.sr = sr - self.bh, self.ah = signal.butter(N=5, Wn=48, btype='high', fs=self.sr) + self.bh, self.ah = signal.butter(N=5, Wn=48, btype="high", fs=self.sr) self.per = 3.7 self.overlap = 0.3 self.tail = self.per + self.overlap diff --git a/vc_infer_pipeline.py b/vc_infer_pipeline.py index 1fa41d1..f85f355 100644 --- a/vc_infer_pipeline.py +++ b/vc_infer_pipeline.py @@ -5,7 +5,9 @@ from config import x_pad, x_query, x_center, x_max import scipy.signal as signal import pyworld, os, traceback, faiss from scipy import signal -bh, ah = signal.butter(N=5, Wn=48, btype='high', fs=16000) + +bh, ah = signal.butter(N=5, Wn=48, btype="high", fs=16000) + class VC(object): def __init__(self, tgt_sr, device, is_half):