diff options
Diffstat (limited to 'g4f')
-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, |