Fix langsegmenter invalid path

This commit is contained in:
KamioRinn 2025-02-26 23:24:08 +08:00
parent b5839e67f0
commit 6890f1b201

View File

@ -50,7 +50,7 @@ def load_fasttext_model(
model = fast_langdetect.ft_detect.infer.fasttext.load_model(str(model_path)) model = fast_langdetect.ft_detect.infer.fasttext.load_model(str(model_path))
else: else:
python_dir = os.getcwd() python_dir = os.getcwd()
if (str(model_path)[:len(python_dir)] == python_dir): if (str(model_path)[:len(python_dir)].upper() == python_dir.upper()):
model = fast_langdetect.ft_detect.infer.fasttext.load_model(os.path.relpath(model_path, python_dir)) model = fast_langdetect.ft_detect.infer.fasttext.load_model(os.path.relpath(model_path, python_dir))
else: else:
import tempfile import tempfile