This commit is contained in:
Ali Abid 2022-05-05 15:25:41 -07:00
parent 56222fbe2b
commit fadcb12ffe
2 changed files with 10 additions and 9 deletions

View File

@ -55,8 +55,7 @@ demo = gr.Interface(
[2, cheetah, 12, 12, 4, 4],
[2, cheetah, 12, 12, 4, 4],
],
enable_queue=True,
)
if __name__ == "__main__":
demo.launch()
demo.launch(enable_queue=True)

View File

@ -242,7 +242,6 @@ class Blocks(BlockContext):
theme: str = "default",
analytics_enabled: Optional[bool] = None,
mode: str = "blocks",
enable_queue: bool = None,
**kwargs,
):
@ -274,10 +273,6 @@ class Blocks(BlockContext):
self.is_space = True if os.getenv("SYSTEM") == "spaces" else False
self.favicon_path = 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):
if Context.root_block is not None:
@ -352,7 +347,9 @@ class Blocks(BlockContext):
"mode": "blocks",
"components": [],
"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():
config["components"].append(
@ -422,6 +419,7 @@ class Blocks(BlockContext):
inbrowser: bool = None,
share: bool = False,
debug: bool = False,
enable_queue: bool = None,
auth: Optional[Callable | Tuple[str, str] | List[Tuple[str, str]]] = None,
auth_message: Optional[str] = None,
private_endpoint: Optional[str] = None,
@ -465,7 +463,6 @@ class Blocks(BlockContext):
local_url (str): Locally accessible link to the demo
share_url (str): Publicly accessible link to the demo (if share=True, otherwise None)
"""
self.config = self.get_config_file()
if (
auth
and not callable(auth)
@ -480,6 +477,11 @@ class Blocks(BlockContext):
self.height = height
self.width = width
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.encrypt = encrypt