Replace Ngrok code with Zrok code

I have a Kaggle notebook which uses the following Ngrok code:

Starting the Web UI with ngrok

--- Variables ---

Ngrok_token = "" #@param {type:"string"}

Put your ngrok token here (obtainable from https://ngrok.com)

Example: Ngrok_token = "2Fw13n4GcJT12g7mSDUC62cdNGb_5svdjf3Gg5vfhr4nGr5gF"

Ngrok_domain = "" # optional, leave empty if you don't have a domain

port = 7865

-----------------

!pip install pyngrok

from pyngrok import ngrok, conf
import fileinput
import sys
import gc

gc.collect()

if Ngrok_token!="":
ngrok.kill()
srv=ngrok.connect(port , pyngrok_config=conf.PyngrokConfig(auth_token=Ngrok_token),
bind_tls=True, domain=Ngrok_domain).public_url
print(srv)
get_ipython().system(f"python {HOME_FOLDER}/Fooocus/entry_with_update.py ")
else:
print('An ngrok token is required. You can get one on https://ngrok.com and paste it into the ngrok_token field.')

I want to try Zrok but do not know what code I need and how to set things up in Zrok. Would appreciate some help. Thanks

Hi @stratman, welcome to the community and to zrok (and OpenZiti).

I don't know how to quite answer such a broad question. How about we try a different approach, can you explain what you're trying to do? Have you read the docs and seen the YouTube videos? There's a bunch of information out there that should hopefully make it more clear?

What do you want help with setting up that the docs Getting Started with zrok | Zrok don't answer for you?

You can also take a look at the sample code for integrating the zrok Python SDK into a server app zrok/sdk/python/examples/http-server at main · openziti/zrok · GitHub

Thanks for replying @TheLumberjack ! So, I have an instance of Fooocus (Gradio frontend) running on Kaggle that has been using Ngrok. But due to the 1GB limit from Ngrok I have been looking at alternative. I do not have my own hosted server setup to configure and do not wish to do so. I want to be able to access the Gradio app from an external address. It doesn't have to be a domain.. I'm happy with an IP address. Can Zrok perform this funtion i.e. a hosted tunnel that gives me an IP to access?

Yes it sure can. You will want to sign up for a zrok account and then learn how to create a "reserved" share. That will get you a static url you can use to access your Fooocus from.

So:

  • sign up for zrok
  • create a reserved share for your fooocus
  • run zrok on kaggle, similar to however you used to run ngrok (python maybe? the sample you showed) but adapt your python to zrok
  • access your fooocus from anywhere :slight_smile:

hth

So, Ngrok is run in the Kaggle notebook by a script called pyngrok. Not being a python wiz, I'm a little stumped on how to get this working. Can you direct me to a forum which may be able to help?

To be honest, I don't exactly know how to help you. I had never heard of kaggle nor Fooocus (nor Gradio) and I'm also pretty unfamiliar with ngrok since I use zrok for those needs. :slight_smile:

Unfortunately, I think that means I'm really not able to talk intelligently to help out. If you told me what ports and what protocol you wanted to have available then I (or someone) could probably help out more with respect to how to do the same sort of thing with zrok and the zrok sdk, but I have never used a "Kaggle notebook"... :frowning:

Can you describe the overall architecture and what you need/want to do? Maybe if you just give me/us the high-level view, it'll be more clear and I'll know better how to help out... Sorry that's not super helpful...