mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-12 10:34:32 +08:00
Block-Components
- fix errors - remove type and optional from blocks context
This commit is contained in:
parent
00b846e7e6
commit
05037f436c
@ -25,7 +25,7 @@ with xray_blocks:
|
||||
xray_scan = gr.inputs.Image()
|
||||
xray_results = gr.outputs.JSON()
|
||||
output_textbox = gr.outputs.Textbox()
|
||||
input_textbox = gr.inputs.Textbox(default="Hello This Is a Input Textbox", component_type="input")
|
||||
input_textbox = gr.inputs.Textbox(default="Hello This Is a Input Textbox")
|
||||
xray_run = gr.Button("Run")
|
||||
xray_run.click(xray_model, inputs=[disease, xray_scan], outputs=xray_results)
|
||||
xray_run.click(xray_model, inputs=[disease, xray_scan], outputs=output_textbox)
|
||||
|
@ -178,7 +178,6 @@ class Blocks(Launchable, BlockContext):
|
||||
config["components"].append(
|
||||
{
|
||||
"id": _id,
|
||||
"type": block.component_type,
|
||||
"props": block.get_template_context(),
|
||||
}
|
||||
)
|
||||
|
@ -44,7 +44,6 @@ class Component(Block):
|
||||
return {
|
||||
"name": self.__class__.__name__.lower(),
|
||||
"label": self.label,
|
||||
"optional": self.optional,
|
||||
}
|
||||
|
||||
@classmethod
|
||||
@ -227,7 +226,7 @@ class Textbox(Component):
|
||||
"The 'type' parameter has been deprecated. Use the Number component instead if you need it.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
default = float(default)
|
||||
default = str(default)
|
||||
self.lines = lines
|
||||
self.placeholder = placeholder
|
||||
self.default = default
|
||||
|
@ -92,7 +92,7 @@ class InputComponent(Component):
|
||||
self.component_type = "input"
|
||||
self.set_interpret_parameters()
|
||||
self.optional = optional
|
||||
super().__init__(label, requires_permissions)
|
||||
super().__init__(label=label, requires_permissions=requires_permissions)
|
||||
|
||||
def preprocess(self, x: Any) -> Any:
|
||||
"""
|
||||
|
@ -48,7 +48,7 @@ class OutputComponent(Component):
|
||||
|
||||
def __init__(self, label: str):
|
||||
self.component_type = "output"
|
||||
super().__init__(label)
|
||||
super().__init__(label=label)
|
||||
|
||||
def postprocess(self, y):
|
||||
"""
|
||||
|
@ -6,7 +6,7 @@ from gradio.components import Component
|
||||
class StaticComponent(Component):
|
||||
def __init__(self, label: str):
|
||||
self.component_type = "static"
|
||||
super().__init__(label)
|
||||
super().__init__(label=label)
|
||||
|
||||
def process(self, y):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user