@@ -86,9 +86,11 @@ def get_supported_file_types() -> tuple[tuple[str, str], ...]:
8686 common_file_types = ["WAV" , "MP3" , "FLAC" , "OGG" , "M4A" , "WMA" ]
8787 res = sorted (
8888 res ,
89- key = lambda x : common_file_types .index (x [0 ])
90- if x [0 ] in common_file_types
91- else len (common_file_types ),
89+ key = lambda x : (
90+ common_file_types .index (x [0 ])
91+ if x [0 ] in common_file_types
92+ else len (common_file_types )
93+ ),
9294 )
9395 return res
9496
@@ -187,15 +189,19 @@ def main():
187189 sg .Push (),
188190 sg .InputText (
189191 key = "model_path" ,
190- default_text = model_candidates [- 1 ].absolute ().as_posix ()
191- if model_candidates
192- else "" ,
192+ default_text = (
193+ model_candidates [- 1 ].absolute ().as_posix ()
194+ if model_candidates
195+ else ""
196+ ),
193197 enable_events = True ,
194198 ),
195199 sg .FileBrowse (
196- initial_folder = Path ("./logs/44k/" ).absolute
197- if Path ("./logs/44k/" ).exists ()
198- else Path ("." ).absolute ().as_posix (),
200+ initial_folder = (
201+ Path ("./logs/44k/" ).absolute
202+ if Path ("./logs/44k/" ).exists ()
203+ else Path ("." ).absolute ().as_posix ()
204+ ),
199205 key = "model_path_browse" ,
200206 file_types = (
201207 ("PyTorch" , "G_*.pth G_*.pt" ),
@@ -208,15 +214,19 @@ def main():
208214 sg .Push (),
209215 sg .InputText (
210216 key = "config_path" ,
211- default_text = Path ("./configs/44k/config.json" ).absolute ().as_posix ()
212- if Path ("./configs/44k/config.json" ).exists ()
213- else "" ,
217+ default_text = (
218+ Path ("./configs/44k/config.json" ).absolute ().as_posix ()
219+ if Path ("./configs/44k/config.json" ).exists ()
220+ else ""
221+ ),
214222 enable_events = True ,
215223 ),
216224 sg .FileBrowse (
217- initial_folder = Path ("./configs/44k/" ).as_posix ()
218- if Path ("./configs/44k/" ).exists ()
219- else Path ("." ).absolute ().as_posix (),
225+ initial_folder = (
226+ Path ("./configs/44k/" ).as_posix ()
227+ if Path ("./configs/44k/" ).exists ()
228+ else Path ("." ).absolute ().as_posix ()
229+ ),
220230 key = "config_path_browse" ,
221231 file_types = (("JSON" , "*.json" ),),
222232 ),
@@ -226,15 +236,17 @@ def main():
226236 sg .Push (),
227237 sg .InputText (
228238 key = "cluster_model_path" ,
229- default_text = Path ("./logs/44k/kmeans.pt" ).absolute ().as_posix ()
230- if Path ("./logs/44k/kmeans.pt" ).exists ()
231- else "" ,
239+ default_text = (
240+ Path ("./logs/44k/kmeans.pt" ).absolute ().as_posix ()
241+ if Path ("./logs/44k/kmeans.pt" ).exists ()
242+ else ""
243+ ),
232244 enable_events = True ,
233245 ),
234246 sg .FileBrowse (
235- initial_folder = "./logs/44k/"
236- if Path ("./logs/44k/" ).exists ()
237- else "." ,
247+ initial_folder = (
248+ "./logs/44k/" if Path ("./logs/44k/" ).exists () else "."
249+ ) ,
238250 key = "cluster_model_path_browse" ,
239251 file_types = (("PyTorch" , "*.pt" ), ("Pickle" , "*.pt *.pth *.pkl" )),
240252 ),
@@ -735,9 +747,11 @@ def apply_preset(name: str) -> None:
735747 recursive = True ,
736748 # svc config
737749 speaker = values ["speaker" ],
738- cluster_model_path = Path (values ["cluster_model_path" ])
739- if values ["cluster_model_path" ]
740- else None ,
750+ cluster_model_path = (
751+ Path (values ["cluster_model_path" ])
752+ if values ["cluster_model_path" ]
753+ else None
754+ ),
741755 transpose = values ["transpose" ],
742756 auto_predict_f0 = values ["auto_predict_f0" ],
743757 cluster_infer_ratio = values ["cluster_infer_ratio" ],
@@ -749,9 +763,9 @@ def apply_preset(name: str) -> None:
749763 chunk_seconds = values ["chunk_seconds" ],
750764 absolute_thresh = values ["absolute_thresh" ],
751765 max_chunk_seconds = values ["max_chunk_seconds" ],
752- device = "cpu"
753- if not values ["use_gpu" ]
754- else get_optimal_device ( ),
766+ device = (
767+ "cpu" if not values ["use_gpu" ] else get_optimal_device ()
768+ ),
755769 ),
756770 )
757771 infer_future .add_done_callback (
@@ -782,9 +796,11 @@ def apply_preset(name: str) -> None:
782796 config_path = Path (values ["config_path" ]),
783797 speaker = values ["speaker" ],
784798 # svc config
785- cluster_model_path = Path (values ["cluster_model_path" ])
786- if values ["cluster_model_path" ]
787- else None ,
799+ cluster_model_path = (
800+ Path (values ["cluster_model_path" ])
801+ if values ["cluster_model_path" ]
802+ else None
803+ ),
788804 transpose = values ["transpose" ],
789805 auto_predict_f0 = values ["auto_predict_f0" ],
790806 cluster_infer_ratio = values ["cluster_infer_ratio" ],
0 commit comments