DeepLearning101 commited on
Commit
e29a665
·
verified ·
1 Parent(s): aa80637

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -14,6 +14,16 @@ from loguru import logger
14
  ssl._create_default_https_context = ssl._create_unverified_context
15
  import nltk
16
 
 
 
 
 
 
 
 
 
 
 
17
  # 檢查是否已下載資源,若未下載則進行下載
18
  nltk_data_path = os.path.expanduser('~/nltk_data')
19
  if not os.path.exists(os.path.join(nltk_data_path, 'corpora/cmudict.zip')):
 
14
  ssl._create_default_https_context = ssl._create_unverified_context
15
  import nltk
16
 
17
+ def upgrade_LangSegment():
18
+ try:
19
+ subprocess.check_call([os.sys.executable, "-m", "pip", "install", "LangSegment", "-i", "https://pypi.org/simple", "--upgrade"])
20
+ print("升級成功")
21
+ except subprocess.CalledProcessError:
22
+ print("升級失敗")
23
+
24
+ # 呼叫升級函數
25
+ upgrade_LangSegment()
26
+
27
  # 檢查是否已下載資源,若未下載則進行下載
28
  nltk_data_path = os.path.expanduser('~/nltk_data')
29
  if not os.path.exists(os.path.join(nltk_data_path, 'corpora/cmudict.zip')):