From 3da0c3d24a745660ea8b089ba5a8c2eaabce1d6f Mon Sep 17 00:00:00 2001 From: henk717 Date: Wed, 25 Aug 2021 13:57:38 +0200 Subject: [PATCH] Remote improvements Some colab's use KoboldAI as a subprocess, rather than making that to complicated for Colab developers its better to just dump the Cloudflare link to a log, in addition to showing the message on screen. That way if KoboldAI itself gets filtered you can easily cat the link or use the existing link grabbing methods. --- aiserver.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/aiserver.py b/aiserver.py index ee7572e0..1a03d7c6 100644 --- a/aiserver.py +++ b/aiserver.py @@ -2104,13 +2104,17 @@ if __name__ == "__main__": loadsettings() # Start Flask/SocketIO (Blocking, so this must be last method!) - print("{0}Server started!\rYou may now connect with a browser at http://127.0.0.1:5000/{1}".format(colors.GREEN, colors.END)) + #socketio.run(app, host='0.0.0.0', port=5000) if(vars.remote): - from flask_cloudflared import start_cloudflared - start_cloudflared(5000) + from flask_cloudflared import _run_cloudflared + cloudflare = _run_cloudflared(5000) + with open('cloudflare.log', 'w') as cloudflarelog: + cloudflarelog.write("KoboldAI has finished loading and is available in the following link : " + cloudflare) + print(format(colors.GREEN) + "KoboldAI has finished loading and is available in the following link : " + cloudflare + format(colors.END)) socketio.run(app, host='0.0.0.0', port=5000) else: import webbrowser webbrowser.open_new('http://localhost:5000') + print("{0}Server started!\rYou may now connect with a browser at http://127.0.0.1:5000/{1}".format(colors.GREEN, colors.END)) socketio.run(app)