@@ -86,9 +86,11 @@ def get_supported_file_types() -> tuple[tuple[str, str], ...]:
86
86
common_file_types = ["WAV" , "MP3" , "FLAC" , "OGG" , "M4A" , "WMA" ]
87
87
res = sorted (
88
88
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
+ ),
92
94
)
93
95
return res
94
96
@@ -187,15 +189,19 @@ def main():
187
189
sg .Push (),
188
190
sg .InputText (
189
191
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
+ ),
193
197
enable_events = True ,
194
198
),
195
199
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
+ ),
199
205
key = "model_path_browse" ,
200
206
file_types = (
201
207
("PyTorch" , "G_*.pth G_*.pt" ),
@@ -208,15 +214,19 @@ def main():
208
214
sg .Push (),
209
215
sg .InputText (
210
216
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
+ ),
214
222
enable_events = True ,
215
223
),
216
224
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
+ ),
220
230
key = "config_path_browse" ,
221
231
file_types = (("JSON" , "*.json" ),),
222
232
),
@@ -226,15 +236,17 @@ def main():
226
236
sg .Push (),
227
237
sg .InputText (
228
238
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
+ ),
232
244
enable_events = True ,
233
245
),
234
246
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
+ ) ,
238
250
key = "cluster_model_path_browse" ,
239
251
file_types = (("PyTorch" , "*.pt" ), ("Pickle" , "*.pt *.pth *.pkl" )),
240
252
),
@@ -350,9 +362,11 @@ def main():
350
362
sg .FileBrowse (
351
363
initial_folder = "." ,
352
364
key = "input_path_browse" ,
353
- file_types = get_supported_file_types_concat ()
354
- if os .name == "nt"
355
- else get_supported_file_types (),
365
+ file_types = (
366
+ get_supported_file_types_concat ()
367
+ if os .name == "nt"
368
+ else get_supported_file_types ()
369
+ ),
356
370
),
357
371
sg .FolderBrowse (
358
372
button_text = "Browse(Folder)" ,
@@ -737,9 +751,11 @@ def apply_preset(name: str) -> None:
737
751
recursive = True ,
738
752
# svc config
739
753
speaker = values ["speaker" ],
740
- cluster_model_path = Path (values ["cluster_model_path" ])
741
- if values ["cluster_model_path" ]
742
- else None ,
754
+ cluster_model_path = (
755
+ Path (values ["cluster_model_path" ])
756
+ if values ["cluster_model_path" ]
757
+ else None
758
+ ),
743
759
transpose = values ["transpose" ],
744
760
auto_predict_f0 = values ["auto_predict_f0" ],
745
761
cluster_infer_ratio = values ["cluster_infer_ratio" ],
@@ -751,9 +767,9 @@ def apply_preset(name: str) -> None:
751
767
chunk_seconds = values ["chunk_seconds" ],
752
768
absolute_thresh = values ["absolute_thresh" ],
753
769
max_chunk_seconds = values ["max_chunk_seconds" ],
754
- device = "cpu"
755
- if not values ["use_gpu" ]
756
- else get_optimal_device ( ),
770
+ device = (
771
+ "cpu" if not values ["use_gpu" ] else get_optimal_device ()
772
+ ),
757
773
),
758
774
)
759
775
infer_future .add_done_callback (
@@ -784,9 +800,11 @@ def apply_preset(name: str) -> None:
784
800
config_path = Path (values ["config_path" ]),
785
801
speaker = values ["speaker" ],
786
802
# svc config
787
- cluster_model_path = Path (values ["cluster_model_path" ])
788
- if values ["cluster_model_path" ]
789
- else None ,
803
+ cluster_model_path = (
804
+ Path (values ["cluster_model_path" ])
805
+ if values ["cluster_model_path" ]
806
+ else None
807
+ ),
790
808
transpose = values ["transpose" ],
791
809
auto_predict_f0 = values ["auto_predict_f0" ],
792
810
cluster_infer_ratio = values ["cluster_infer_ratio" ],
0 commit comments