Skip to content

Commit

Permalink
Merge pull request oobabooga#348 from mayaeary/feature/koboldai-api-s…
Browse files Browse the repository at this point in the history
…hare

flask_cloudflared for shared tunnels
  • Loading branch information
oobabooga authored Mar 15, 2023
2 parents 445ebf0 + 0552ab2 commit d3a280e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions extensions/api/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flask_cloudflared==0.0.12
10 changes: 9 additions & 1 deletion extensions/api/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,15 @@ def do_POST(self):
def run_server():
server_addr = ('0.0.0.0' if shared.args.listen else '127.0.0.1', params['port'])
server = ThreadingHTTPServer(server_addr, Handler)
print(f'Starting KoboldAI compatible api at http://{server_addr[0]}:{server_addr[1]}/api')
if shared.args.share:
try:
from flask_cloudflared import _run_cloudflared
public_url = _run_cloudflared(params['port'], params['port'] + 1)
print(f'Starting KoboldAI compatible api at {public_url}/api')
except ImportError:
print('You should install flask_cloudflared manually')
else:
print(f'Starting KoboldAI compatible api at http://{server_addr[0]}:{server_addr[1]}/api')
server.serve_forever()

def ui():
Expand Down

0 comments on commit d3a280e

Please sign in to comment.