diff --git a/.changeset/shy-pots-stare.md b/.changeset/shy-pots-stare.md new file mode 100644 index 000000000000..6453b0003550 --- /dev/null +++ b/.changeset/shy-pots-stare.md @@ -0,0 +1,5 @@ +--- +"gradio": patch +--- + +fix:Fix `gr.load()` so that it works with the SSE v1 protocol diff --git a/gradio/external.py b/gradio/external.py index f151b6cb1748..4fd88d0a3c2a 100644 --- a/gradio/external.py +++ b/gradio/external.py @@ -538,9 +538,7 @@ def from_spaces_blocks(space: str, hf_token: str | None) -> Blocks: predict_fns = [] for fn_index, endpoint in enumerate(client.endpoints): assert isinstance(endpoint, Endpoint) - helper = None - if endpoint.protocol in ("ws", "sse"): - helper = client.new_helper(fn_index) + helper = client.new_helper(fn_index) predict_fns.append(endpoint.make_end_to_end_fn(helper)) return gradio.Blocks.from_config(client.config, predict_fns, client.src) diff --git a/test/test_external.py b/test/test_external.py index e2f7f4e27e10..d026c3cc3ff1 100644 --- a/test/test_external.py +++ b/test/test_external.py @@ -340,6 +340,18 @@ def test_loading_files_via_proxy_works(self): ) assert r.status_code == 200 + def test_private_space_v4_sse_v1(self): + io = gr.load( + "spaces/gradio-tests/not-actually-private-spacev4-sse-v1", + hf_token=HfFolder.get_token(), + ) + try: + output = io("abc") + assert output == "abc" + assert io.theme.name == "gradio/monochrome" + except TooManyRequestsError: + pass + class TestLoadInterfaceWithExamples: def test_interface_load_examples(self, tmp_path):