luca-medeiros / lang-segment-anything

SAM with text prompt
Apache License 2.0
1.53k stars 167 forks source link

run in colab then url can't open #22

Closed Li-sde closed 1 year ago

Li-sde commented 1 year ago

When I run: !lightning run app /content/lang-segment-anything/app.py

Your Lightning App is starting. This won't take long. INFO: Your app has started. View it in your browser: http://127.0.0.1:7501/view /usr/bin/xdg-open: 869: www-browser: not found /usr/bin/xdg-open: 869: links2: not found /usr/bin/xdg-open: 869: elinks: not found /usr/bin/xdg-open: 869: links: not found /usr/bin/xdg-open: 869: lynx: not found /usr/bin/xdg-open: 869: w3m: not found xdg-open: no method available for opening 'http://127.0.0.1:7501/view' Downloading (…)ingDINO_SwinB.cfg.py: 100% 1.01k/1.01k [00:00<00:00, 1.03MB/s] final text_encoder_type: bert-base-uncased Downloading (…)okenizer_config.json: 100% 28.0/28.0 [00:00<00:00, 18.1kB/s] Downloading (…)lve/main/config.json: 100% 570/570 [00:00<00:00, 383kB/s] Downloading (…)solve/main/vocab.txt: 100% 232k/232k [00:00<00:00, 3.86MB/s] Downloading (…)/main/tokenizer.json: 100% 466k/466k [00:00<00:00, 5.82MB/s] Downloading model.safetensors: 100% 440M/440M [00:03<00:00, 132MB/s] Some weights of the model checkpoint at bert-base-uncased were not used when initializing BertModel: ['cls.seq_relationship.bias', 'cls.predictions.transform.LayerNorm.weight', 'cls.predictions.bias', 'cls.seq_relationship.weight', 'cls.predictions.transform.dense.weight', 'cls.predictions.transform.dense.bias', 'cls.predictions.transform.LayerNorm.bias']

To create a public link, set share=True in launch().

But the url is invalid. Please help to check, you could try it in your colab.

siddharthksah commented 1 year ago

When you run a local server, it's typically accessible on your machine only, not over the Internet. '127.0.0.1' is the IP address for 'localhost', which means 'this machine'. The number after the colon is the port number. Therefore, you can only access this URL on the machine where you're running the server, not on other machines.

That's why the URL appears to be "invalid" if you try to access it on another machine. However, if you are running this on a remote machine such as Google Colab or a remote server, you will not be able to access this URL directly since 'localhost' or '127.0.0.1' refers to your local machine, not the machine where the server is running.

If you're running this on Google Colab or a similar service, you may need to use a service like ngrok or localtunnel to expose your local server to the internet. These tools create a public URL for your local server, allowing you to access it from anywhere.

Also, there seems to be an issue with xdg-open command which is not finding any text-based browser to open the URL. If you are running this on a system with a GUI, you may want to set your default browser with xdg-settings command.

However, please note that opening a web browser on a server or a cloud environment like Google Colab is not possible as these environments are headless and don't have a GUI.

Again, if you're working in a local environment, you should be able to simply copy and paste the URL into your web browser. If you're on a remote machine, you'll need to use a service like ngrok or localtunnel as mentioned above.

One more thing to note: sometimes you may face the issue that the port is being used by another process. In such cases, you might need to either stop the process that's currently using the port or run your server on a different port.

luca-medeiros commented 1 year ago

Somehow related #25