HycJack commited on
Commit
244bf38
·
1 Parent(s): 778d159

add import

Browse files
Files changed (1) hide show
  1. main.py +9 -3
main.py CHANGED
@@ -7,6 +7,12 @@ import io
7
  import numpy as np
8
  import pandas as pd
9
 
 
 
 
 
 
 
10
  model = RapidOCR()
11
  app = FastAPI()
12
 
@@ -75,7 +81,7 @@ async def ocr_table(file: UploadFile = File(...)):
75
  with open(tmp_path, "wb") as f:
76
  f.write(contents)
77
 
78
- logger.info(f"文件已保存至 {tmp_path}")
79
 
80
  # 使用示例
81
  input_args = RapidTableInput(model_type=ModelType.PPSTRUCTURE_ZH)
@@ -90,7 +96,7 @@ async def ocr_table(file: UploadFile = File(...)):
90
  try:
91
  if tmp_path.exists():
92
  tmp_path.unlink()
93
- logger.debug(f"已删除临时文件 {tmp_path}")
94
  except Exception as exc:
95
- logger.warning(f"删除临时文件 {tmp_path} 失败: {exc}")
96
  return None
 
7
  import numpy as np
8
  import pandas as pd
9
 
10
+
11
+ import uuid
12
+
13
+ from pathlib import Path
14
+
15
+
16
  model = RapidOCR()
17
  app = FastAPI()
18
 
 
81
  with open(tmp_path, "wb") as f:
82
  f.write(contents)
83
 
84
+ print(f"文件已保存至 {tmp_path}")
85
 
86
  # 使用示例
87
  input_args = RapidTableInput(model_type=ModelType.PPSTRUCTURE_ZH)
 
96
  try:
97
  if tmp_path.exists():
98
  tmp_path.unlink()
99
+ print(f"已删除临时文件 {tmp_path}")
100
  except Exception as exc:
101
+ print(f"删除临时文件 {tmp_path} 失败: {exc}")
102
  return None