Refactor: Format Code with Ruff and Update Deprecated G2PW Link (#2255)

* ruff check --fix

* ruff format --line-length 120 --target-version py39

* Change the link for G2PW Model

* update pytorch version and colab
This commit is contained in:
XXXXRT666
2025-04-07 09:42:47 +01:00
committed by GitHub
parent 9da7e17efe
commit 53cac93589
132 changed files with 8185 additions and 6648 deletions

View File

@@ -101,21 +101,31 @@
"import time\n",
"import socket\n",
"import urllib.request\n",
"\n",
"\n",
"def iframe_thread(port):\n",
" while True:\n",
" time.sleep(0.5)\n",
" sock= socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n",
" result = sock.connect_ex(('127.0.0.1', port))\n",
" sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n",
" result = sock.connect_ex((\"127.0.0.1\", port))\n",
" if result == 0:\n",
" break\n",
" sock.close()\n",
"\n",
" from colorama import Fore, Style\n",
" print (Fore.GREEN + \"\\nIP: \", Fore. RED, urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"), \"\\n\", Style. RESET_ALL)\n",
" print(\n",
" Fore.GREEN + \"\\nIP: \",\n",
" Fore.RED,\n",
" urllib.request.urlopen(\"https://ipv4.icanhazip.com\").read().decode(\"utf8\").strip(\"\\n\"),\n",
" \"\\n\",\n",
" Style.RESET_ALL,\n",
" )\n",
" p = subprocess.Popen([\"lt\", \"--port\", \"{}\".format(port)], stdout=subprocess.PIPE)\n",
" for line in p.stdout:\n",
" print(line.decode(), end='')\n",
"threading.Thread (target=iframe_thread, daemon=True, args=(9874,)).start()\n",
" print(line.decode(), end=\"\")\n",
"\n",
"\n",
"threading.Thread(target=iframe_thread, daemon=True, args=(9874,)).start()\n",
"\n",
"!python webui.py"
]
@@ -143,26 +153,32 @@
"# 开启推理页面\n",
"%cd /kaggle/working/GPT-SoVITS/\n",
"!npm install -g localtunnel\n",
"import subprocess\n",
"import threading\n",
"import time\n",
"import socket\n",
"import urllib.request\n",
"\n",
"\n",
"def iframe_thread(port):\n",
" while True:\n",
" time.sleep(0.5)\n",
" sock= socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n",
" result = sock.connect_ex(('127.0.0.1', port))\n",
" sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n",
" result = sock.connect_ex((\"127.0.0.1\", port))\n",
" if result == 0:\n",
" break\n",
" sock.close()\n",
"\n",
" from colorama import Fore, Style\n",
" print (Fore.GREEN + \"\\nIP: \", Fore. RED, urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"), \"\\n\", Style. RESET_ALL)\n",
" print(\n",
" Fore.GREEN + \"\\nIP: \",\n",
" Fore.RED,\n",
" urllib.request.urlopen(\"https://ipv4.icanhazip.com\").read().decode(\"utf8\").strip(\"\\n\"),\n",
" \"\\n\",\n",
" Style.RESET_ALL,\n",
" )\n",
" p = subprocess.Popen([\"lt\", \"--port\", \"{}\".format(port)], stdout=subprocess.PIPE)\n",
" for line in p.stdout:\n",
" print(line.decode(), end='')\n",
"threading.Thread (target=iframe_thread, daemon=True, args=(9872,)).start()\n",
" print(line.decode(), end=\"\")\n",
"\n",
"\n",
"threading.Thread(target=iframe_thread, daemon=True, args=(9872,)).start()\n",
"\n",
"!python ./GPT_SoVITS/inference_webui.py"
]