default to http, open chrome automatically

This commit is contained in:
wataru 2023-01-17 08:12:57 +09:00
parent e646edfbbc
commit ed246b65d2
2 changed files with 15 additions and 3 deletions

View File

@ -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

View File

@ -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: