MCPcopy Index your code
hub / github.com/PDFMathTranslate/PDFMathTranslate / setup_gui

Function setup_gui

pdf2zh/gui.py:801–882  ·  view source on GitHub ↗

Setup the GUI with the given parameters. Inputs: - share: Whether to share the GUI. - auth_file: The file path to read the user name and password. Outputs: - None

(
    share: bool = False, auth_file: list = ["", ""], server_port=7860
)

Source from the content-addressed store, hash-verified

799
800
801def setup_gui(
802 share: bool = False, auth_file: list = ["", ""], server_port=7860
803) -> None:
804 """
805 Setup the GUI with the given parameters.
806
807 Inputs:
808 - share: Whether to share the GUI.
809 - auth_file: The file path to read the user name and password.
810
811 Outputs:
812 - None
813 """
814 user_list, html = parse_user_passwd(auth_file)
815 if flag_demo:
816 demo.launch(server_name="0.0.0.0", max_file_size="5mb", inbrowser=True)
817 else:
818 if len(user_list) == 0:
819 try:
820 demo.launch(
821 server_name="0.0.0.0",
822 debug=True,
823 inbrowser=True,
824 share=share,
825 server_port=server_port,
826 )
827 except Exception:
828 print(
829 "Error launching GUI using 0.0.0.0.\nThis may be caused by global mode of proxy software."
830 )
831 try:
832 demo.launch(
833 server_name="127.0.0.1",
834 debug=True,
835 inbrowser=True,
836 share=share,
837 server_port=server_port,
838 )
839 except Exception:
840 print(
841 "Error launching GUI using 127.0.0.1.\nThis may be caused by global mode of proxy software."
842 )
843 demo.launch(
844 debug=True, inbrowser=True, share=True, server_port=server_port
845 )
846 else:
847 try:
848 demo.launch(
849 server_name="0.0.0.0",
850 debug=True,
851 inbrowser=True,
852 share=share,
853 auth=user_list,
854 auth_message=html,
855 server_port=server_port,
856 )
857 except Exception:
858 print(

Callers 2

mainFunction · 0.90
gui.pyFile · 0.85

Calls 1

parse_user_passwdFunction · 0.85

Tested by

no test coverage detected