Skip to content

Fixed misleading log when server_name is '0.0.0.0'#2176

Merged
abidlabs merged 3 commits into
gradio-app:mainfrom
lamhoangtung:main
Sep 5, 2022
Merged

Fixed misleading log when server_name is '0.0.0.0'#2176
abidlabs merged 3 commits into
gradio-app:mainfrom
lamhoangtung:main

Conversation

@lamhoangtung
Copy link
Copy Markdown
Contributor

Description

Assuming I have this script:

import gradio as gr
demo = gr.Blocks(title="Test")
demo.launch(server_name='0.0.0.0', server_port=4567)

Currently, running this with gradio 3.2 produce this log:

Running on local URL:  http://localhost:4567/

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

But this is misleading to user since localhost is often associated to 127.0.0.1 and the log should say this instead:

Running on local URL:  http://0.0.0.0:4567/

This small PR basically fixed this misleading log

Checklist:

  • I have performed a self-review of my own code
  • My code follows the style guidelines of this project
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@abidlabs
Copy link
Copy Markdown
Member

abidlabs commented Sep 5, 2022

Thanks for the PR @lamhoangtung! I agree with the point about what should be printed, but removing the url_host_name isn't a good idea because of the issue on Windows machine described in #382.

But we can modify what we print to be clearer. Let me push a fix here and merge it in.

@lamhoangtung
Copy link
Copy Markdown
Contributor Author

That made a lot more sense to me why it was localhost before. Glad that I will be fixed soon. Thanks @abidlabs

@abidlabs
Copy link
Copy Markdown
Member

abidlabs commented Sep 5, 2022

I've made some changes. Would you be able to try them out @lamhoangtung? If they work for you as well, I'll go ahead and merge these in

Copy link
Copy Markdown
Contributor Author

@lamhoangtung lamhoangtung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Working fine on my local machine as well @abidlabs

@abidlabs
Copy link
Copy Markdown
Member

abidlabs commented Sep 5, 2022

Thanks @lamhoangtung, merging. Will issue a patch release to pypi sometime next week!

@abidlabs abidlabs merged commit 66ef85b into gradio-app:main Sep 5, 2022
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

Successfully merging this pull request may close these issues.

2 participants