mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-30 11:00:11 +08:00
parent
56222fbe2b
commit
b7ed8d6646
@ -55,8 +55,7 @@ demo = gr.Interface(
|
|||||||
[2, cheetah, 12, 12, 4, 4],
|
[2, cheetah, 12, 12, 4, 4],
|
||||||
[2, cheetah, 12, 12, 4, 4],
|
[2, cheetah, 12, 12, 4, 4],
|
||||||
],
|
],
|
||||||
enable_queue=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
demo.launch()
|
demo.launch(enable_queue=True)
|
||||||
|
@ -242,7 +242,6 @@ class Blocks(BlockContext):
|
|||||||
theme: str = "default",
|
theme: str = "default",
|
||||||
analytics_enabled: Optional[bool] = None,
|
analytics_enabled: Optional[bool] = None,
|
||||||
mode: str = "blocks",
|
mode: str = "blocks",
|
||||||
enable_queue: bool = None,
|
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
|
|
||||||
@ -274,10 +273,6 @@ class Blocks(BlockContext):
|
|||||||
self.is_space = True if os.getenv("SYSTEM") == "spaces" else False
|
self.is_space = True if os.getenv("SYSTEM") == "spaces" else False
|
||||||
self.favicon_path = None
|
self.favicon_path = None
|
||||||
self.auth = None
|
self.auth = None
|
||||||
if self.is_space and enable_queue is None:
|
|
||||||
self.enable_queue = True
|
|
||||||
else:
|
|
||||||
self.enable_queue = enable_queue or False
|
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
if Context.root_block is not None:
|
if Context.root_block is not None:
|
||||||
@ -352,7 +347,9 @@ class Blocks(BlockContext):
|
|||||||
"mode": "blocks",
|
"mode": "blocks",
|
||||||
"components": [],
|
"components": [],
|
||||||
"theme": self.theme,
|
"theme": self.theme,
|
||||||
"enable_queue": self.enable_queue,
|
"enable_queue": getattr(
|
||||||
|
self, "enable_queue", False
|
||||||
|
), # attribute set at launch
|
||||||
}
|
}
|
||||||
for _id, block in self.blocks.items():
|
for _id, block in self.blocks.items():
|
||||||
config["components"].append(
|
config["components"].append(
|
||||||
@ -422,6 +419,7 @@ class Blocks(BlockContext):
|
|||||||
inbrowser: bool = None,
|
inbrowser: bool = None,
|
||||||
share: bool = False,
|
share: bool = False,
|
||||||
debug: bool = False,
|
debug: bool = False,
|
||||||
|
enable_queue: bool = None,
|
||||||
auth: Optional[Callable | Tuple[str, str] | List[Tuple[str, str]]] = None,
|
auth: Optional[Callable | Tuple[str, str] | List[Tuple[str, str]]] = None,
|
||||||
auth_message: Optional[str] = None,
|
auth_message: Optional[str] = None,
|
||||||
private_endpoint: Optional[str] = None,
|
private_endpoint: Optional[str] = None,
|
||||||
@ -465,7 +463,6 @@ class Blocks(BlockContext):
|
|||||||
local_url (str): Locally accessible link to the demo
|
local_url (str): Locally accessible link to the demo
|
||||||
share_url (str): Publicly accessible link to the demo (if share=True, otherwise None)
|
share_url (str): Publicly accessible link to the demo (if share=True, otherwise None)
|
||||||
"""
|
"""
|
||||||
self.config = self.get_config_file()
|
|
||||||
if (
|
if (
|
||||||
auth
|
auth
|
||||||
and not callable(auth)
|
and not callable(auth)
|
||||||
@ -480,6 +477,11 @@ class Blocks(BlockContext):
|
|||||||
self.height = height
|
self.height = height
|
||||||
self.width = width
|
self.width = width
|
||||||
self.favicon_path = favicon_path
|
self.favicon_path = favicon_path
|
||||||
|
if self.is_space and enable_queue is None:
|
||||||
|
self.enable_queue = True
|
||||||
|
else:
|
||||||
|
self.enable_queue = enable_queue or False
|
||||||
|
|
||||||
self.config = self.get_config_file()
|
self.config = self.get_config_file()
|
||||||
|
|
||||||
self.encrypt = encrypt
|
self.encrypt = encrypt
|
||||||
|
Loading…
Reference in New Issue
Block a user