fix bug
This commit is contained in:
parent
1bc4aeee85
commit
6ca110f1f4
@ -176,16 +176,17 @@ def run_ocr(image):
|
|||||||
command = [
|
command = [
|
||||||
"/home/tmfc/miniconda3/envs/got/bin/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,
|
||||||
|
"> /home/tmfc/apps/got-ocr/img.txt"
|
||||||
]
|
]
|
||||||
|
|
||||||
result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
try:
|
||||||
|
subprocess.run(command, check=True)
|
||||||
# 获取 OCR 识别的输出
|
except subprocess.CalledProcessError as e:
|
||||||
ocr_output = result.stdout
|
return f"识别失败: {e}"
|
||||||
|
with open("/home/tmfc/apps/got-ocr/img.txt", 'r', encoding='utf-8') as f:
|
||||||
return ocr_output
|
content = f.read()
|
||||||
|
return content
|
||||||
|
|
||||||
with gr.Blocks() as iface:
|
with gr.Blocks() as iface:
|
||||||
gr.Markdown("# 大模型工具集")
|
gr.Markdown("# 大模型工具集")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user