Exclude typer from the requirements list for Wasm env and fix gradio.cli not to be imported (#7823)

* Exclude `typer` from the requirements list for Wasm env and fix `gradio.cli` not to be imported

* add changeset

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
This commit is contained in:
Yuichiro Tachibana (Tsuchiya) 2024-03-26 04:21:19 +09:00 committed by GitHub
parent bf5110a26b
commit e0a8b7fa2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
"gradio": patch
---
feat:Exclude `typer` from the requirements list for Wasm env and fix `gradio.cli` not to be imported

View File

@ -7,7 +7,6 @@ import gradio.templates
from gradio import components, layouts, themes
from gradio.blocks import Blocks
from gradio.chat_interface import ChatInterface
from gradio.cli import deploy
from gradio.components import (
HTML,
JSON,
@ -99,5 +98,9 @@ from gradio.templates import (
)
from gradio.themes import Base as Theme
from gradio.utils import NO_RELOAD, get_package_version, set_static_paths
from gradio.wasm_utils import IS_WASM
if not IS_WASM:
from gradio.cli import deploy
__version__ = get_package_version()

View File

@ -680,6 +680,11 @@ class Blocks(BlockContext, BlocksEvents, metaclass=BlocksMeta):
@property
def _is_running_in_reload_thread(self):
if wasm_utils.IS_WASM:
# Wasm (Pyodide) doesn't support threading,
# so the return value is always False.
return False
from gradio.cli.commands.reload import reload_thread
return getattr(reload_thread, "running_reload", False)

View File

@ -21,6 +21,6 @@ pyyaml>=5.0,<7.0
semantic_version~=2.0
typing_extensions~=4.0
uvicorn>=0.14.0; sys.platform != 'emscripten'
typer[all]>=0.9,<1.0
typer[all]>=0.9,<1.0; sys.platform != 'emscripten'
tomlkit==0.12.0
ruff>=0.2.2; sys.platform != 'emscripten'