From ed246b65d2323ddcb0d00d967a45b2e15e2531ee Mon Sep 17 00:00:00 2001 From: wataru Date: Tue, 17 Jan 2023 08:12:57 +0900 Subject: [PATCH] default to http, open chrome automatically --- README.md | 1 - server/MMVCServerSIO.py | 17 +++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fc88c74c..55fb484e 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,6 @@ Windows版とMac版を提供しています。事前準備は必要ありませ - [MMVCServerSIO_win_onnxgpu_nocudav.1.3.6.1.exe](https://drive.google.com/file/d/1fnVirudwkoNsY5kabG-295OrqgHzvcHf/view?usp=sharing) 255MB - ### 過去バージョン - [MMVCServerSIO_mac_onnxcpu_v.1.3.6.0](https://drive.google.com/file/d/1fWtvAN0OMygAUDoQlZ8TAZvLSMW_aI3B/view?usp=sharing) 181MB - [MMVCServerSIO_win_onnxdirectML_cudav.1.3.6.0.exe](https://drive.google.com/file/d/13ojs8VRconmARDGMoQapCVg3H9AG6PAz/view?usp=sharing) 1864MB diff --git a/server/MMVCServerSIO.py b/server/MMVCServerSIO.py index c5a1333c..7c64b69d 100755 --- a/server/MMVCServerSIO.py +++ b/server/MMVCServerSIO.py @@ -9,6 +9,7 @@ from distutils.util import strtobool sys.path.append("MMVC_Client/python") import uvicorn +import webbrowser from mods.ssl import create_self_signed_cert from voice_changer.VoiceChangerManager import VoiceChangerManager @@ -26,7 +27,7 @@ def setupArgParser(): parser.add_argument("-m", type=str, help="path for the model file") parser.add_argument("-o", type=str, help="path for the onnx model file") parser.add_argument("--https", type=strtobool, - default=True, help="use https") + default=False, help="use https") parser.add_argument("--httpsKey", type=str, default="ssl.key", help="path for the key of https") parser.add_argument("--httpsCert", type=str, @@ -35,6 +36,8 @@ def setupArgParser(): default=True, help="generate self-signed certificate") parser.add_argument("--colab", type=strtobool, default=False, help="run on colab") + parser.add_argument("--openWindow", type=strtobool, + default=True, help="open browser. only for local use") return parser @@ -184,7 +187,17 @@ if __name__ == '__main__': printMessage(f"https://{hostname}:{PORT}/{path}", level=1) else: printMessage(f"http://localhost:{PORT}/{path}", level=1) - printMessage(f"http://{hostname}:{PORT}/{path}", level=1) + if args.openWindow: + printMessage(f"ブラウザ(Chroem)の起動を試みています。", level=2) + try: + webbrowser.get('chrome') + webbrowser.get('chrome').open(f"http://localhost:{PORT}/{path}", new=1, autoraise=True) + except Exception as e: + printMessage(f"{e}", level=1) + printMessage(f"ブラウザの起動に失敗しました。", level=2) + printMessage(f"手動でブラウザを立ち上げて表示されたURLにアクセスしてください。", level=2) + print() + # printMessage(f"http://{hostname}:{PORT}/{path}", level=1) # サーバ起動 if args.https: