Skip to content

Commit

Permalink
Exclude typer from the requirements list for Wasm env and fix `grad…
Browse files Browse the repository at this point in the history
…io.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>
  • Loading branch information
3 people committed Mar 25, 2024
1 parent bf5110a commit e0a8b7f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-spies-cross.md
@@ -0,0 +1,5 @@
---
"gradio": patch
---

feat:Exclude `typer` from the requirements list for Wasm env and fix `gradio.cli` not to be imported
5 changes: 4 additions & 1 deletion gradio/__init__.py
Expand Up @@ -7,7 +7,6 @@
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,
Expand Down Expand Up @@ -99,5 +98,9 @@
)
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()
5 changes: 5 additions & 0 deletions gradio/blocks.py
Expand Up @@ -680,6 +680,11 @@ def get_component(self, id: int) -> Component | BlockContext:

@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)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -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'

0 comments on commit e0a8b7f

Please sign in to comment.