voice-changer/server/restapi/mods/Trainer_Speakers.py

16 lines
503 B
Python
Raw Normal View History

2022-12-31 14:25:28 +03:00
from fastapi.responses import JSONResponse
from fastapi.encoders import jsonable_encoder
2022-12-31 19:59:01 +03:00
from restapi.utils.files import get_dir_list
2022-12-31 14:25:28 +03:00
import os
# CreateはFileUploaderで実装。
def mod_get_speakers():
os.makedirs("MMVC_Trainer/dataset/textful", exist_ok=True)
speakers = get_dir_list("MMVC_Trainer/dataset/textful/")
data = {
"speakers":sorted(speakers)
}
json_compatible_item_data = jsonable_encoder(data)
return JSONResponse(content=json_compatible_item_data)