luca-medeiros/lang-segment-anything

How to use launch(share=True)

Closed this issue ยท 1 comments

Instructions To Reproduce the ๐Ÿ› Bug:

When I run this project in a server, I want to use the frontend in my own machine's browser. I run the code lighting run app app,py, then open the link in my machine's browser, I get the error, 121.0.0.1 refused the response. Could you have a way to handle this issue. I make sure that service can be used in the server's own browser.

@dongxiaolong
When running Gradio apps in Lightning, the app generates two pages: the Lightning AI page and the Gradio page. Eventually, the Gradio page is shown on the Lightning AI page.

Screenshot 2023-04-14 at 8 46 08 AM

Only after the second page is loaded it will show up.

There might be 2 reasons why you are having trouble opening the UI.

  1. Model loading takes time. The first run needs to cache the model. The Lightning UI loads fast but the Gradio takes much more, that's why you see refused response. Try waiting a bit more and refreshing the page.
  2. Your server, if not local, might not have the Gradio port open. You might want to set a static port here
    super().__init__()

From what I know, if you wanna share apps you can use lightning run app app.py --cloud but I haven't tested it yet. I don't see a launch=True option in the ServeGradio class...