This commit is contained in:
William Jin 2024-09-26 16:06:06 +08:00
parent 1bc4aeee85
commit 6ca110f1f4

View File

@ -176,16 +176,17 @@ def run_ocr(image):
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
"--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)
# 获取 OCR 识别的输出
ocr_output = result.stdout
return ocr_output
try:
subprocess.run(command, check=True)
except subprocess.CalledProcessError as e:
return f"识别失败: {e}"
with open("/home/tmfc/apps/got-ocr/img.txt", 'r', encoding='utf-8') as f:
content = f.read()
return content
with gr.Blocks() as iface:
gr.Markdown("# 大模型工具集")