From aa446fc4a5429b4672bd3ad52832387d1f9d1d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Faruk=20=C3=96zdemir?= Date: Tue, 1 Mar 2022 18:33:59 +0300 Subject: [PATCH] Block-Events - fix circular import - add is_space field to Blocks --- gradio/blocks.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gradio/blocks.py b/gradio/blocks.py index 626d0bedb6..c6e3e34fa2 100644 --- a/gradio/blocks.py +++ b/gradio/blocks.py @@ -1,3 +1,4 @@ +import os from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple from gradio import utils @@ -33,7 +34,7 @@ class Block: } ) - def change(self, fn: str, inputs: List[Component], outputs: List[Component]) -> None: + def change(self, fn: str, inputs: List["Component"], outputs: List["Component"]) -> None: """ Adds change event to the component's dependencies. @@ -61,7 +62,7 @@ class Block: } ) - def save(self, fn: str, inputs: List[Component], outputs: List[Component]) -> None: + def save(self, fn: str, inputs: List["Component"], outputs: List["Component"]) -> None: """ Adds save event to the component's dependencies. @@ -132,6 +133,7 @@ class Blocks(Launchable, BlockContext): self.theme = theme self.requires_permissions = False # TODO: needs to be implemented self.enable_queue = False + self.is_space = True if os.getenv("SYSTEM") == "spaces" else False super().__init__() Context.root_block = self