Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PaddleOCR-2.9
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wuzekai
PaddleOCR-2.9
Commits
b1cc8a27
You need to sign in or sign up before continuing.
Commit
b1cc8a27
authored
Jul 08, 2025
by
wuzekai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update ocr.py
parent
96e3991e
Pipeline
#579
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
ocr.py
ocr.py
+31
-0
No files found.
ocr.py
View file @
b1cc8a27
...
...
@@ -125,3 +125,34 @@ def download_image(uuid_str):
except
Exception
as
e
:
return
jsonify
({
"error"
:
f
"Failed to send image: {str(e)}"
}),
500
@
ocr
.
route
(
"/delete/<uuid_str>"
,
methods
=
[
"DELETE"
])
def
delete_files
(
uuid_str
):
if
not
is_valid_uuid
(
uuid_str
):
return
jsonify
({
"error"
:
"Invalid UUID format"
}),
400
deleted_files
=
[]
# 删除上传的图片文件
image_file
=
os
.
path
.
join
(
upload_dir
,
f
"{uuid_str}.jpg"
)
if
os
.
path
.
exists
(
image_file
):
os
.
remove
(
image_file
)
deleted_files
.
append
(
f
"{uuid_str}.jpg"
)
# 删除输出的 JSON 文件
json_file
=
os
.
path
.
join
(
output_dir
,
f
"{uuid_str}.json"
)
if
os
.
path
.
exists
(
json_file
):
os
.
remove
(
json_file
)
deleted_files
.
append
(
f
"{uuid_str}.json"
)
# 删除 OCR 结果文件
result_file
=
os
.
path
.
join
(
result_dir
,
f
"{uuid_str}.jpg"
)
if
os
.
path
.
exists
(
result_file
):
os
.
remove
(
result_file
)
deleted_files
.
append
(
f
"{uuid_str}.jpg"
)
if
not
deleted_files
:
return
jsonify
({
"message"
:
"No files found for this UUID"
}),
404
return
jsonify
({
"message"
:
"Files deleted successfully"
,
"deleted_files"
:
deleted_files
}),
200
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment