mirror of
https://github.com/gradio-app/gradio.git
synced 2025-04-06 12:30:29 +08:00
Fix bug preventing layout components to be used as custom components (#7050)
This commit is contained in:
parent
45df1ce5d7
commit
a336508646
5
.changeset/cruel-games-wash.md
Normal file
5
.changeset/cruel-games-wash.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
fix:Fix bug preventing layout components to be used as custom components
|
@ -618,9 +618,9 @@ class Blocks(BlockContext, BlocksEvents, metaclass=BlocksMeta):
|
||||
|
||||
self.queue()
|
||||
|
||||
def get_component(self, id: int) -> Component:
|
||||
def get_component(self, id: int) -> Component | BlockContext:
|
||||
comp = self.blocks[id]
|
||||
assert isinstance(comp, components.Component), f"{comp}"
|
||||
assert isinstance(comp, (components.Component, BlockContext)), f"{comp}"
|
||||
return comp
|
||||
|
||||
@property
|
||||
@ -2307,8 +2307,10 @@ Received outputs:
|
||||
# The config has the most specific API info (taking into account the parameters
|
||||
# of the component), so we use that if it exists. Otherwise, we fallback to the
|
||||
# Serializer's API info.
|
||||
info = self.get_component(component["id"]).api_info()
|
||||
example = self.get_component(component["id"]).example_inputs()
|
||||
comp = self.get_component(component["id"])
|
||||
assert isinstance(comp, components.Component)
|
||||
info = comp.api_info()
|
||||
example = comp.example_inputs()
|
||||
python_type = client_utils.json_schema_to_python_type(info)
|
||||
dependency_info["parameters"].append(
|
||||
{
|
||||
@ -2335,8 +2337,10 @@ Received outputs:
|
||||
if self.blocks[component["id"]].skip_api:
|
||||
continue
|
||||
label = component["props"].get("label", f"value_{o}")
|
||||
info = self.get_component(component["id"]).api_info()
|
||||
example = self.get_component(component["id"]).example_inputs()
|
||||
comp = self.get_component(component["id"])
|
||||
assert isinstance(comp, components.Component)
|
||||
info = comp.api_info()
|
||||
example = comp.example_inputs()
|
||||
python_type = client_utils.json_schema_to_python_type(info)
|
||||
dependency_info["returns"].append(
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user