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.
This commit is contained in:
henk717 2021-08-25 13:57:38 +02:00
parent 33d76a5132
commit 3da0c3d24a
1 changed files with 7 additions and 3 deletions

View File

@ -2104,13 +2104,17 @@ if __name__ == "__main__":
loadsettings() loadsettings()
# Start Flask/SocketIO (Blocking, so this must be last method!) # 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) #socketio.run(app, host='0.0.0.0', port=5000)
if(vars.remote): if(vars.remote):
from flask_cloudflared import start_cloudflared from flask_cloudflared import _run_cloudflared
start_cloudflared(5000) 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) socketio.run(app, host='0.0.0.0', port=5000)
else: else:
import webbrowser import webbrowser
webbrowser.open_new('http://localhost:5000') 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) socketio.run(app)