30 lines
737 B
Python
30 lines
737 B
Python
# coding=utf-8
|
|
import os
|
|
import sys
|
|
import time
|
|
import numpy as np
|
|
|
|
# Add project root to sys.path
|
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
# project_root = os.path.dirname(current_dir)
|
|
# if project_root not in sys.path:
|
|
# sys.path.append(project_root)
|
|
|
|
print("Importing PaddleOCR...")
|
|
from paddleocr import PaddleOCR
|
|
print("Importing LlmUtil...")
|
|
# from Util.LlmUtil import get_llm_response
|
|
print("Imports done.")
|
|
|
|
def main():
|
|
image_path = os.path.join(current_dir, "2.jpg")
|
|
print(f"Initializing OCR...")
|
|
ocr = PaddleOCR(use_textline_orientation=True, lang="ch")
|
|
print("Running OCR...")
|
|
result = ocr.ocr(image_path)
|
|
print("OCR Done.")
|
|
print(result)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|