去除 conda 激活命令
This commit is contained in:
parent
13b8cff9d9
commit
965331ebb6
@ -172,21 +172,14 @@ def run_ocr(image):
|
|||||||
image_path = os.path.expanduser("/home/tmfc/apps/got-ocr/img.png")
|
image_path = os.path.expanduser("/home/tmfc/apps/got-ocr/img.png")
|
||||||
image.save(image_path)
|
image.save(image_path)
|
||||||
|
|
||||||
# 激活 Conda 环境
|
|
||||||
activate_env_command = "conda activate got"
|
|
||||||
|
|
||||||
# 调用 OCR 命令
|
# 调用 OCR 命令
|
||||||
ocr_command = [
|
command = [
|
||||||
"python3", "/home/tmfc/apps/got-ocr/GOT/demo/run_ocr_2.0_crop.py",
|
"/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/",
|
"--model-name", "/home/tmfc/apps/got-ocr/models/",
|
||||||
"--image-file", image_path
|
"--image-file", image_path
|
||||||
]
|
]
|
||||||
|
|
||||||
# 构建完整的命令
|
result = subprocess.run(command, capture_output=True, text=True)
|
||||||
full_command = f"{activate_env_command} && {' '.join(ocr_command)}"
|
|
||||||
|
|
||||||
# 使用 shell 执行命令
|
|
||||||
result = subprocess.run(full_command, shell=True, capture_output=True, text=True)
|
|
||||||
|
|
||||||
# 获取 OCR 识别的输出
|
# 获取 OCR 识别的输出
|
||||||
ocr_output = result.stdout
|
ocr_output = result.stdout
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user