Spaces:
Sleeping
Sleeping
do not delete tmp file when error
Browse files
main.py
CHANGED
|
@@ -94,10 +94,10 @@ async def ocr_table(file: UploadFile = File(...)):
|
|
| 94 |
finally:
|
| 95 |
# ------------------- ⑥ 清理临时文件 -------------------
|
| 96 |
# 为了防止磁盘被塞满,尽量在请求结束后删除文件
|
| 97 |
-
try:
|
| 98 |
-
|
| 99 |
-
|
| 100 |
print(f"已删除临时文件 {tmp_path}")
|
| 101 |
-
except Exception as exc:
|
| 102 |
-
|
| 103 |
return None
|
|
|
|
| 94 |
finally:
|
| 95 |
# ------------------- ⑥ 清理临时文件 -------------------
|
| 96 |
# 为了防止磁盘被塞满,尽量在请求结束后删除文件
|
| 97 |
+
# try:
|
| 98 |
+
# if tmp_path.exists():
|
| 99 |
+
# tmp_path.unlink()
|
| 100 |
print(f"已删除临时文件 {tmp_path}")
|
| 101 |
+
# except Exception as exc:
|
| 102 |
+
# print(f"删除临时文件 {tmp_path} 失败: {exc}")
|
| 103 |
return None
|