diff --git a/chyoso_toolkit_ui.py b/chyoso_toolkit_ui.py index d1e5b40..f064f79 100644 --- a/chyoso_toolkit_ui.py +++ b/chyoso_toolkit_ui.py @@ -172,21 +172,14 @@ def run_ocr(image): image_path = os.path.expanduser("/home/tmfc/apps/got-ocr/img.png") image.save(image_path) - # 激活 Conda 环境 - activate_env_command = "conda activate got" - # 调用 OCR 命令 - ocr_command = [ - "python3", "/home/tmfc/apps/got-ocr/GOT/demo/run_ocr_2.0_crop.py", + command = [ + "/home/tmfc/miniconda3/envs/got/bin/python3", "/home/tmfc/apps/got-ocr/GOT/demo/run_ocr_2.0_crop.py", "--model-name", "/home/tmfc/apps/got-ocr/models/", "--image-file", image_path ] - # 构建完整的命令 - full_command = f"{activate_env_command} && {' '.join(ocr_command)}" - - # 使用 shell 执行命令 - result = subprocess.run(full_command, shell=True, capture_output=True, text=True) + result = subprocess.run(command, capture_output=True, text=True) # 获取 OCR 识别的输出 ocr_output = result.stdout