diff options
author | Tekky <98614666+xtekky@users.noreply.github.com> | 2023-10-12 15:32:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-12 15:32:50 +0200 |
commit | 86248b44bcb4261c627335e24f5713e242793ece (patch) | |
tree | 59671d1777b76bade80b4a0c5ce8a42121878a9e /g4f/gui | |
parent | ~ | Merge pull request #1053 from Lin-jun-xiang/fix_GptGo (diff) | |
parent | change "Models" to "Providers" (diff) | |
download | gpt4free-86248b44bcb4261c627335e24f5713e242793ece.tar gpt4free-86248b44bcb4261c627335e24f5713e242793ece.tar.gz gpt4free-86248b44bcb4261c627335e24f5713e242793ece.tar.bz2 gpt4free-86248b44bcb4261c627335e24f5713e242793ece.tar.lz gpt4free-86248b44bcb4261c627335e24f5713e242793ece.tar.xz gpt4free-86248b44bcb4261c627335e24f5713e242793ece.tar.zst gpt4free-86248b44bcb4261c627335e24f5713e242793ece.zip |
Diffstat (limited to 'g4f/gui')
-rw-r--r-- | g4f/gui/__init__.py | 2 | ||||
-rw-r--r-- | g4f/gui/run.py | 30 |
2 files changed, 19 insertions, 13 deletions
diff --git a/g4f/gui/__init__.py b/g4f/gui/__init__.py index 48b78881..a8000e71 100644 --- a/g4f/gui/__init__.py +++ b/g4f/gui/__init__.py @@ -27,4 +27,4 @@ def run_gui(host: str = '0.0.0.0', port: int = 80, debug: bool = False) -> None: print(f"Running on port {config['port']}") app.run(**config) - print(f"Closing port {config['port']}")
\ No newline at end of file + print(f"Closing port {config['port']}") diff --git a/g4f/gui/run.py b/g4f/gui/run.py index 731c7cbf..0f94814c 100644 --- a/g4f/gui/run.py +++ b/g4f/gui/run.py @@ -1,18 +1,24 @@ -from g4f.gui import run_gui from argparse import ArgumentParser +from g4f.gui import run_gui -if __name__ == '__main__': - - parser = ArgumentParser(description='Run the GUI') - - parser.add_argument('-host', type=str, default='0.0.0.0', help='hostname') - parser.add_argument('-port', type=int, default=80, help='port') - parser.add_argument('-debug', action='store_true', help='debug mode') - args = parser.parse_args() - port = args.port +def gui_parser(): + parser = ArgumentParser(description="Run the GUI") + parser.add_argument("-host", type=str, default="0.0.0.0", help="hostname") + parser.add_argument("-port", type=int, default=80, help="port") + parser.add_argument("-debug", action="store_true", help="debug mode") + return parser + + +def run_gui_args(args): host = args.host + port = args.port debug = args.debug - - run_gui(host, port, debug)
\ No newline at end of file + run_gui(host, port, debug) + + +if __name__ == "__main__": + parser = gui_parser() + args = parser.parse_args() + run_gui_args(args) |