WIP: pyinstaller

This commit is contained in:
wataru 2023-01-14 09:40:08 +09:00
parent ca080a7fdc
commit 90807f555a
2 changed files with 23 additions and 25 deletions

View File

@ -47,37 +47,35 @@ def printMessage(message, level=0):
else: else:
print(f"\033[47m {message}\033[0m") print(f"\033[47m {message}\033[0m")
# global app_socketio
# global app_fastapi
global app_socketio
global app_fastapi
parser = setupArgParser() parser = setupArgParser()
args = parser.parse_args() args = parser.parse_args()
printMessage(f"Phase name:{__name__}", level=2) # printMessage(f"Phase name:{__name__}", level=2)
thisFilename = os.path.basename(__file__)[:-3] # thisFilename = os.path.basename(__file__)[:-3]
if __name__ == thisFilename or args.colab == True: # if __name__ == thisFilename or args.colab == True:
printMessage(f"PHASE3:{__name__}", level=2) # printMessage(f"PHASE3:{__name__}", level=2)
TYPE = args.t TYPE = args.t
PORT = args.p PORT = args.p
CONFIG = args.c CONFIG = args.c
MODEL = args.m if args.m != None else None MODEL = args.m if args.m != None else None
ONNX_MODEL = args.o if args.o != None else None ONNX_MODEL = args.o if args.o != None else None
if args.colab == True: if args.colab == True:
os.environ["colab"] = "True" os.environ["colab"] = "True"
# if os.getenv("EX_TB_PORT"): # if os.getenv("EX_TB_PORT"):
# EX_TB_PORT = os.environ["EX_TB_PORT"] # EX_TB_PORT = os.environ["EX_TB_PORT"]
# exApplitionInfo.external_tensorboard_port = int(EX_TB_PORT) # exApplitionInfo.external_tensorboard_port = int(EX_TB_PORT)
voiceChangerManager = VoiceChangerManager.get_instance() voiceChangerManager = VoiceChangerManager.get_instance()
if CONFIG and (MODEL or ONNX_MODEL): if CONFIG and (MODEL or ONNX_MODEL):
voiceChangerManager.loadModel(CONFIG, MODEL, ONNX_MODEL) voiceChangerManager.loadModel(CONFIG, MODEL, ONNX_MODEL)
app_fastapi = MMVC_Rest.get_instance(voiceChangerManager) app_fastapi = MMVC_Rest.get_instance(voiceChangerManager)
app_socketio = MMVC_SocketIOApp.get_instance(app_fastapi, voiceChangerManager) app_socketio = MMVC_SocketIOApp.get_instance(app_fastapi, voiceChangerManager)
if __name__ == '__mp_main__': if __name__ == '__mp_main__':

View File

@ -1,6 +1,6 @@
frontend_path = "../client/demo/dist" import os, sys
frontend_path = os.path.join(sys._MEIPASS, "dist") if hasattr(sys, "_MEIPASS") else "../client/demo/dist"
ERROR_NO_ONNX_SESSION = "ERROR_NO_ONNX_SESSION" ERROR_NO_ONNX_SESSION = "ERROR_NO_ONNX_SESSION"