Repository: gradio-app/gradio
Pull request: api_open does not take precedence over show_api 
## Description

The two parameters now operate independently. If api_open=False, then the api_page will still be shown. This is a slight change in behavior but users still have the ability to hide them if they wish. If we automatically hide the api docs, user's don't have a way to override that. 

Closes: #5434 


## 🎯 PRs Should Target Issues

Before your create a PR, please check to see if there is [an existing issue](https://github.com/gradio-app/gradio/issues) for this change. If not, please create an issue before you create this PR, unless the fix is very small. 

Not adhering to this guideline will result in the PR being closed. 

## Tests

1. PRs will only be merged if tests pass on CI. To run the tests locally, please set up [your Gradio environment locally](https://github.com/gradio-app/gradio/blob/main/CONTRIBUTING.md) and run the tests: `bash scripts/run_all_tests.sh`

2. You may need to run the linters: `bash scripts/format_backend.sh` and `bash scripts/format_frontend.sh`
  


Problem statement:
`show_api` doesn't work when queue is enabled
### Describe the bug

Setting `show_api=False` doesn't have any effect if queueing is enabled 

### Have you searched existing issues?  🔎

- [X] I have searched and found no existing issues

### Reproduction

```py
import gradio as gr

with gr.Blocks() as demo:
    gr.Dropdown(["name 1", "name 3"])
    
demo.queue().launch(show_api=False)
```

### Screenshot

_No response_

### Logs

_No response_

### System Info

```shell
gradio 3.42.0
```


### Severity

I can work around it

Hints from issue discussion:

Commit message: Merge branch '5434-show-api-bugfix' of github.com:gradio-app/gradio into 5434-show-api-bugfix

Patch to review:
diff --git a/.changeset/social-bushes-study.md b/.changeset/social-bushes-study.md
new file mode 100644
index 0000000000..294de4f856
--- /dev/null
+++ b/.changeset/social-bushes-study.md
@@ -0,0 +1,5 @@
+---
+"gradio": patch
+---
+
+fix:api_open does not take precedence over show_api 
diff --git a/gradio/blocks.py b/gradio/blocks.py
index cbe31d0a87..1a054e7972 100644
--- a/gradio/blocks.py
+++ b/gradio/blocks.py
@@ -1778,7 +1778,7 @@ def launch(
             ssl_keyfile_password: If a password is provided, will use this with the ssl certificate for https.
             ssl_verify: If False, skips certificate validation which allows self-signed certificates to be used.
             quiet: If True, suppresses most print statements.
-            show_api: If True, shows the api docs in the footer of the app. Default True. If the queue is enabled, then api_open parameter of .queue() will determine if the api docs are shown, independent of the value of show_api.
+            show_api: If True, shows the api docs in the footer of the app. Default True.             show_api: If True, shows the api docs in the footer of the app. Default True. If the queue is enabled and api_open=True, then api docs are not shown, independent of the value of show_api.
             file_directories: This parameter has been renamed to `allowed_paths`. It will be removed in a future version.
             allowed_paths: List of complete filepaths or parent directories that gradio is allowed to serve (in addition to the directory containing the gradio python file). Must be absolute paths. Warning: if you provide directories, any files in these directories or their subdirectories are accessible to all users of your app.
             blocked_paths: List of complete filepaths or parent directories that gradio is not allowed to serve (i.e. users of your app are not allowed to access). Must be absolute paths. Warning: takes precedence over `allowed_paths` and all other directories exposed by Gradio by default.
@@ -1848,7 +1848,8 @@ def reverse(text):
             self.enable_queue = self.enable_queue is True
         if self.enable_queue and not hasattr(self, "_queue"):
             self.queue()
-        self.show_api = self.api_open if self.enable_queue else show_api
+
+        self.show_api = show_api
 
         if file_directories is not None:
             warn_deprecation(
diff --git a/test/test_routes.py b/test/test_routes.py
index 11a9928278..a987cb9c57 100644
--- a/test/test_routes.py
+++ b/test/test_routes.py
@@ -586,7 +586,7 @@ def test_predict_route_is_blocked_if_api_open_false():
         api_open=False
     )
     app, _, _ = io.launch(prevent_thread_lock=True)
-    assert not io.show_api
+    assert io.show_api
     client = TestClient(app)
     result = client.post(
         "/api/predict", json={"fn_index": 0, "data": [5], "session_hash": "foo"}
@@ -607,7 +607,7 @@ def test_predict_route_not_blocked_if_queue_disabled():
     app, _, _ = demo.queue(api_open=False).launch(
         prevent_thread_lock=True, show_api=True
     )
-    assert not demo.show_api
+    assert demo.show_api
     client = TestClient(app)
 
     result = client.post("/api/blocked", json={"data": [], "session_hash": "foo"})
@@ -630,7 +630,7 @@ def test_predict_route_not_blocked_if_routes_open():
     app, _, _ = demo.queue(api_open=True).launch(
         prevent_thread_lock=True, show_api=False
     )
-    assert demo.show_api
+    assert not demo.show_api
     client = TestClient(app)
 
     result = client.post(


Code review comments:
diff_hunk: @@ -1778,7 +1778,7 @@ def launch(
             ssl_keyfile_password: If a password is provided, will use this with the ssl certificate for https.
             ssl_verify: If False, skips certificate validation which allows self-signed certificates to be used.
             quiet: If True, suppresses most print statements.
-            show_api: If True, shows the api docs in the footer of the app. Default True. If the queue is enabled, then api_open parameter of .queue() will determine if the api docs are shown, independent of the value of show_api.
+            show_api: If True, shows the api docs in the footer of the app. Default True.             show_api: If True, shows the api docs in the footer of the app. Default True. If the queue is enabled and api_open=True, then api docs are not shown, independent of the value of show_api.
path: gradio/blocks.py
text: @user1:
Docstring repeated here