Skip to content

Commit 6b4370e

Browse files
committed
delete file in temp bucket after doing OCR
1 parent ccad42f commit 6b4370e

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
ocr-lambda.zip
22
__pycache__
33
pdfrw*
4+
tessdata/deu.traineddata

ocr.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@ def ocr(src_bucketname, src_filename, dest_bucketname, dest_filename, empty_page
4949
output.addpage(p)
5050
output.write('{}/output.pdf'.format(TMP_DIR))
5151
s3.upload_file("{}/output.pdf".format(TMP_DIR), dest_bucketname, dest_filename)
52+
s3.delete_object(Bucket=src_bucketname, Key=src_filename)
5253
for f in ['partial.pdf', 'output.pdf', DOWNLOAD_FILE] + tar.getnames():
5354
os.remove("{}/{}".format(TMP_DIR, f))

0 commit comments

Comments
 (0)