Update __init__.py

This commit is contained in:
H Lohaus 2024-04-06 16:21:22 +02:00 committed by GitHub
parent adffb216cd
commit a2240a711c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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,