Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to bind multiple ports to share before running the main script like Ngrok? #842

Open
krigeta opened this issue Jan 28, 2025 · 0 comments

Comments

@krigeta
Copy link

krigeta commented Jan 28, 2025

I am trying to bind 3 ports using this approach:

command = 'source /kaggle/tmp/.venv/bin/activate; python app.py'
port = '6969'
port_t = '8077'
port_f = '9876'
# ------------------------
os.system(f"filebrowser -r /kaggle -p 9876 > /dev/null 2>&1 &")
%load_ext tensorboard
%tensorboard --logdir logs --port 8077
cmd = f'/kaggle/working/zrok/zrok share public http://localhost:{port} --headless & /kaggle/working/zrok/zrok share public http://localhost:{port_t} --headless & /kaggle/working/zrok/zrok share public http://localhost:{port_f} --headless & {command}'
get_ipython().system(cmd)

but I want to achieve something like this but using Zrok and not Ngrok:

import os
from pyngrok import ngrok
from IPython.display import clear_output, Javascript
ngrok.kill()
%cd /kaggle/working/program_ml
os.system(f"filebrowser -r /kaggle -p 9876 > /dev/null 2>&1 &")
clear_output()
%load_ext tensorboard
%tensorboard --logdir logs --port 8077
p_tunnel = ngrok.connect(6969)
t_tunnel = ngrok.connect(8077)
f_tunnel = ngrok.connect(9876)
clear_output()
print("Applio Url:", p_tunnel.public_url)
print("Tensorboard Url:", t_tunnel.public_url)
print("File Url:", f_tunnel.public_url)
print("Save the link for later, this will take a while...")

!source /kaggle/tmp/.venv/bin/activate; python app.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant