فهرست منبع

Merge branch 'main' of https://github.com/Byaidu/PDFMathTranslate into main

Rongxin 1 سال پیش
والد
کامیت
a6530429cd
2فایلهای تغییر یافته به همراه5 افزوده شده و 21 حذف شده
  1. 1 1
      pdf2zh/__init__.py
  2. 4 20
      pdf2zh/gui.py

+ 1 - 1
pdf2zh/__init__.py

@@ -1,2 +1,2 @@
-__version__ = "1.7.6"
+__version__ = "1.7.7"
 __author__ = "Byaidu"

+ 4 - 20
pdf2zh/gui.py

@@ -303,30 +303,14 @@ def setup_gui():
     try:
         demo.launch(server_name="0.0.0.0", debug=True, inbrowser=True, share=False)
     except Exception as e:
-        print(f"Error launching GUI usin 0.0.0.0, using localhost instead: {e}")
+        print(f"Error launching GUI using 0.0.0.0.\nThis may be caused by global mode of proxy software.")
         try:
-            demo.launch(
-                server_name="127.0.0.1", debug=True, inbrowser=True, share=False
-            )
+            demo.launch(server_name="127.0.0.1", debug=True, inbrowser=True, share=False)
         except Exception as e:
-            print(
-                f"Error launching GUI using localhost, creating a shareable link instead: {e}"
-            )
+            print(f"Error launching GUI using 127.0.0.1.\nThis may be caused by global mode of proxy software.")
             demo.launch(server_name="0.0.0.0", debug=True, inbrowser=True, share=True)
 
 
 # For auto-reloading while developing
 if __name__ == "__main__":
-    try:
-        demo.launch(server_name="0.0.0.0", debug=True, inbrowser=True, share=False)
-    except Exception as e:
-        print(f"Error launching GUI usin 0.0.0.0, using localhost instead: {e}")
-        try:
-            demo.launch(
-                server_name="127.0.0.1", debug=True, inbrowser=True, share=False
-            )
-        except Exception as e:
-            print(
-                f"Error launching GUI using localhost, creating a shareable link instead: {e}"
-            )
-            demo.launch(server_name="0.0.0.0", debug=True, inbrowser=True, share=True)
+    setup_gui()