diff options
author | Arran Hobson Sayers <ahobsonsayers@gmail.com> | 2023-10-12 03:35:11 +0200 |
---|---|---|
committer | Arran Hobson Sayers <ahobsonsayers@gmail.com> | 2023-10-12 03:35:11 +0200 |
commit | 77697be33381a01350d0818ff069469faea2f4ac (patch) | |
tree | 418bfd7e3a9d01b94a6dcc3077c96ca87e674e73 /g4f/gui | |
parent | ~ (diff) | |
download | gpt4free-77697be33381a01350d0818ff069469faea2f4ac.tar gpt4free-77697be33381a01350d0818ff069469faea2f4ac.tar.gz gpt4free-77697be33381a01350d0818ff069469faea2f4ac.tar.bz2 gpt4free-77697be33381a01350d0818ff069469faea2f4ac.tar.lz gpt4free-77697be33381a01350d0818ff069469faea2f4ac.tar.xz gpt4free-77697be33381a01350d0818ff069469faea2f4ac.tar.zst gpt4free-77697be33381a01350d0818ff069469faea2f4ac.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) |