@@ -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
),
@@ -735,9 +747,11 @@ def apply_preset(name: str) -> None:
735
747
recursive = True ,
736
748
# svc config
737
749
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
+ ),
741
755
transpose = values ["transpose" ],
742
756
auto_predict_f0 = values ["auto_predict_f0" ],
743
757
cluster_infer_ratio = values ["cluster_infer_ratio" ],
@@ -749,9 +763,9 @@ def apply_preset(name: str) -> None:
749
763
chunk_seconds = values ["chunk_seconds" ],
750
764
absolute_thresh = values ["absolute_thresh" ],
751
765
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
+ ),
755
769
),
756
770
)
757
771
infer_future .add_done_callback (
@@ -782,9 +796,11 @@ def apply_preset(name: str) -> None:
782
796
config_path = Path (values ["config_path" ]),
783
797
speaker = values ["speaker" ],
784
798
# 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
+ ),
788
804
transpose = values ["transpose" ],
789
805
auto_predict_f0 = values ["auto_predict_f0" ],
790
806
cluster_infer_ratio = values ["cluster_infer_ratio" ],
0 commit comments