run.py 800 B

12345678910111213141516171819202122232425262728
  1. from .gui_parser import gui_parser
  2. from ..cookies import read_cookie_files
  3. from ..gui import run_gui
  4. from ..Provider import ProviderUtils
  5. import g4f.cookies
  6. import g4f.debug
  7. def run_gui_args(args):
  8. if args.debug:
  9. g4f.debug.logging = True
  10. if not args.ignore_cookie_files:
  11. read_cookie_files()
  12. host = args.host
  13. port = args.port
  14. debug = args.debug
  15. g4f.cookies.browsers = [g4f.cookies[browser] for browser in args.cookie_browsers]
  16. if args.ignored_providers:
  17. for provider in args.ignored_providers:
  18. if provider in ProviderUtils.convert:
  19. ProviderUtils.convert[provider].working = False
  20. run_gui(host, port, debug)
  21. if __name__ == "__main__":
  22. parser = gui_parser()
  23. args = parser.parse_args()
  24. run_gui_args(args)