forked from mrq/ai-voice-cloning
master (#112)
Fixes Gradio bugging out when attempting to load a missing train.json. Reviewed-on: mrq/ai-voice-cloning#112 Co-authored-by: tigi6346 <tigi6346@noreply.localhost> Co-committed-by: tigi6346 <tigi6346@noreply.localhost>
This commit is contained in:
parent
008a1f5f8f
commit
dcdcf8516c
14
src/webui.py
Executable file → Normal file
14
src/webui.py
Executable file → Normal file
|
@ -218,9 +218,19 @@ def import_training_settings_proxy( voice ):
|
|||
messages = []
|
||||
injson = f'./training/{voice}/train.json'
|
||||
statedir = f'./training/{voice}/finetune/training_state/'
|
||||
output = {}
|
||||
|
||||
with open(injson, 'r', encoding="utf-8") as f:
|
||||
settings = json.loads(f.read())
|
||||
try:
|
||||
with open(injson, 'r', encoding="utf-8") as f:
|
||||
settings = json.loads(f.read())
|
||||
except:
|
||||
messages.append(f"Error import /{voice}/train.json")
|
||||
|
||||
for k in TRAINING_SETTINGS:
|
||||
output[k] = TRAINING_SETTINGS[k].value
|
||||
|
||||
output = list(output.values())
|
||||
return output[:-1] + ["\n".join(messages)]
|
||||
|
||||
if os.path.isdir(statedir):
|
||||
resumes = sorted([int(d[:-6]) for d in os.listdir(statedir) if d[-6:] == ".state" ])
|
||||
|
|
Loading…
Reference in New Issue
Block a user