diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-04-06 16:21:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-06 16:21:22 +0200 |
commit | a2240a711c26e305d587b6b546b3b6c066e40650 (patch) | |
tree | 0070a1019be573b03e44ddf156cd5008cfd501a5 /g4f/gui | |
parent | Update __init__.py (diff) | |
download | gpt4free-a2240a711c26e305d587b6b546b3b6c066e40650.tar gpt4free-a2240a711c26e305d587b6b546b3b6c066e40650.tar.gz gpt4free-a2240a711c26e305d587b6b546b3b6c066e40650.tar.bz2 gpt4free-a2240a711c26e305d587b6b546b3b6c066e40650.tar.lz gpt4free-a2240a711c26e305d587b6b546b3b6c066e40650.tar.xz gpt4free-a2240a711c26e305d587b6b546b3b6c066e40650.tar.zst gpt4free-a2240a711c26e305d587b6b546b3b6c066e40650.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/gui/__init__.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/g4f/gui/__init__.py b/g4f/gui/__init__.py index 3f695200..16b03e4c 100644 --- a/g4f/gui/__init__.py +++ b/g4f/gui/__init__.py @@ -1,16 +1,20 @@ from ..errors import MissingRequirementsError +try: + from .server.app import app + from .server.website import Website + from .server.backend import Backend_Api + import_error = None +except ImportError as e: + import_error = e + def run_gui(host: str = '0.0.0.0', port: int = 8080, debug: bool = False) -> None: - try: - from .server.app import app - from .server.website import Website - from .server.backend import Backend_Api - except ImportError: - raise MissingRequirementsError('Install "flask" package for the gui') + if import_error is not None: + raise MissingRequirementsError(f'Install "gui" requirements | pip install g4f[gui] -U\n{import_error}') if debug: - import g4f - g4f.debug.logging = True + from g4f import debug + debug.logging = True config = { 'host' : host, 'port' : port, |