Repository: gradio-app/gradio

Issue:
`Client` doesn't work properly when a Space has a method with `api_name=False`
### Describe the bug

Originally reported [here](https://huggingface.co/spaces/hysts/Shap-E/discussions/18).

If a Space had a method with `api_name=False`, the following error occurs when calling it with `Client`:
```
TypeError: can only concatenate str (not "bool") to str
```

I think this error occurs when calling a Space with `gr.Examples`.

### Have you searched existing issues?  🔎

- [X] I have searched and found no existing issues

### Reproduction

When I use `Client` to call [this Space](https://huggingface.co/spaces/hysts-debug/client-bool-api-name-error)
```python
import gradio as gr

with gr.Blocks() as demo:
    text = gr.Text()
    out = gr.Text()
    btn = gr.Button()
    text.submit(fn=lambda x: x, inputs=text, outputs=out, api_name=False)
    btn.click(fn=lambda x: x, inputs=text, outputs=out, api_name='run')
demo.queue().launch()
```
with the following code
```python
from gradio_client import Client

client = Client('hysts-debug/client-bool-api-name-error')
out = client.predict('aaa', api_name='/run')
```
I get the following error.
```
Traceback (most recent call last):
  File "/tmp/temp/run.py", line 4, in <module>
    out = client.predict('aaa', api_name='/run')
  File "/home/ubuntu/.virtualenvs/py31011/lib/python3.10/site-packages/gradio_client/client.py", line 285, in predict
    return self.submit(*args, api_name=api_name, fn_index=fn_index).result()
  File "/home/ubuntu/.virtualenvs/py31011/lib/python3.10/site-packages/gradio_client/client.py", line 313, in submit
    inferred_fn_index = self._infer_fn_index(api_name, fn_index)
  File "/home/ubuntu/.virtualenvs/py31011/lib/python3.10/site-packages/gradio_client/client.py", line 555, in _infer_fn_index
    if "/" + config_api_name == api_name:
TypeError: can only concatenate str (not "bool") to str
```

If I remove the method with `api_name=False`, the error doesn't occur.

In the case of the [Shap-E Space](https://huggingface.co/spaces/hysts/Shap-E), it doesn't have methods with `api_name=False` explicitly, but as it has `gr.Examples`, I guess its method has `api_name=False` implicitly and causing this error.

If I change the code of the Space to the following, the same error occurs.
```python
import gradio as gr

with gr.Blocks() as demo:
    text = gr.Text()
    out = gr.Text()
    btn = gr.Button()
    gr.Examples(examples=['aaa', 'bbb'], inputs=text)
    btn.click(fn=lambda x: x, inputs=text, outputs=out, api_name='run')
demo.queue().launch()
```

### Screenshot

_No response_

### Logs

_No response_

### System Info

```shell
gradio==3.36.1
gradio_client==0.2.8
```


### Severity

Blocking usage of gradio


Discussion:
Hmm I thought we fixed this in the latest version of `gradio_client`, cc some discussion here: https://github.com/gradio-app/gradio/pull/4861

cc @freddyaboulton 
It doesn't seem to be fixed in the `main` branch. I think this will be fixed if we replace [this line](https://github.com/gradio-app/gradio/blob/4bf301324b3b180fa32166ff1774312b01334c88/client/python/gradio_client/client.py#L553) with
```python
if not config_api_name:
```

Resolving patch:
diff --git a/client/python/gradio_client/client.py b/client/python/gradio_client/client.py
--- a/client/python/gradio_client/client.py
+++ b/client/python/gradio_client/client.py
@@ -550,7 +550,7 @@ def _infer_fn_index(self, api_name: str | None, fn_index: int | None) -> int:
         if api_name is not None:
             for i, d in enumerate(self.config["dependencies"]):
                 config_api_name = d.get("api_name")
-                if config_api_name is None:
+                if config_api_name is None or config_api_name is False:
                     continue
                 if "/" + config_api_name == api_name:
                     inferred_fn_index = i


Test patch:
diff --git a/client/python/test/test_client.py b/client/python/test/test_client.py
--- a/client/python/test/test_client.py
+++ b/client/python/test/test_client.py
@@ -366,6 +366,11 @@ def greet(name):
         finally:
             server.thread.join(timeout=1)
 
+    def test_predict_with_space_with_api_name_false(self):
+        client = Client("gradio-tests/client-bool-api-name-error")
+        assert client.predict("Hello!", api_name="/run") == "Hello!"
+        assert client.predict("Freddy", api_name="/say_hello") == "hello"
+
 
 class TestStatusUpdates:
     @patch("gradio_client.client.Endpoint.make_end_to_end_fn")