mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-24 10:54:04 +08:00
Fix gr.load()
so that it works with the SSE v1 protocol (#6810)
* fix for gr.load() * add changeset * fix * add test * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
6b130e26b9
commit
526fb6c446
5
.changeset/shy-pots-stare.md
Normal file
5
.changeset/shy-pots-stare.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
fix:Fix `gr.load()` so that it works with the SSE v1 protocol
|
@ -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)
|
||||
|
||||
|
@ -340,6 +340,18 @@ class TestLoadInterface:
|
||||
)
|
||||
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):
|
||||
|
Loading…
Reference in New Issue
Block a user