Skip to content

Automatically opens the app in the default web browser #3190

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

Closed
wants to merge 1 commit into from

Conversation

androllen
Copy link

Thank you for open-sourcing such an excellent project.

Motivation

It provides an easy way to launch Gradio apps locally without manually navigating to the browser.

Modification

set browser_enable option for open the app in your default web browser. Runs a Gradio web application as a desktop app.

eg1:

# It won't open automatically
(envs) D:\MinerU>python D:\MinerU\mineru\cli\gradio_app.py --server-name 127.0.0.1 --server-port 7861 --enable-browser false

eg2:

# It will open automatically
(envs) D:\MinerU>python D:\MinerU\mineru\cli\gradio_app.py --server-name 127.0.0.1 --server-port 7861 --enable-browser true

eg3:

# It won't open automatically
(envs) D:\MinerU>python D:\MinerU\mineru\cli\gradio_app.py --server-name 127.0.0.1 --server-port 7861

BC-breaking (Optional)

Does the modification introduce changes that break the backward compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here and update the documentation.

Checklist

Before PR:

  • Pre-commit or other linting tools are used to fix the potential lint issues.
  • Bug fixes are fully covered by unit tests, the case that causes the bug should be added in the unit tests.
  • The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  • The documentation has been modified accordingly, like docstring or example tutorials.

After PR:

  • If the modification has potential influence on downstream or other related projects, this PR should be tested with those projects.
  • CLA has been signed and all committers have signed the CLA in this PR.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 27, 2025
Copy link
Contributor

github-actions bot commented Jul 27, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@dosubot dosubot bot added the enhancement New feature or request label Jul 27, 2025
@androllen
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Jul 27, 2025
@myhloli myhloli requested a review from Copilot July 28, 2025 11:04
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a command-line option to automatically open the Gradio web application in the default web browser when launching the application.

  • Adds --enable-browser CLI option with a default value of False to control browser auto-opening
  • Passes the browser enable flag to Gradio's demo.launch() method via the inbrowser parameter

@myhloli
Copy link
Collaborator

myhloli commented Jul 28, 2025

gradio has numerous parameters, but in reality, we only need a small subset of them. Typically, we launch gradio as a service on a server, so there's no need to open a browser to view it via parameters at startup.
We still appreciate your PR and look forward to your next contribution.

@myhloli myhloli closed this Jul 28, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jul 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants