Alex Strick van Linschoten commited on
Commit
94a07a2
1 Parent(s): 513a0c5

add directory creation

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -47,6 +47,10 @@ def predict(pdf, confidence, generate_file):
47
  )
48
  if probs[0] > (confidence / 100):
49
  redaction_count = len(images)
 
 
 
 
50
  image_pixmap.save(
51
  os.path.join(
52
  tmp_dir, filename_without_extension, f"page-{page_num}.png"
47
  )
48
  if probs[0] > (confidence / 100):
49
  redaction_count = len(images)
50
+ if not os.path.exists(
51
+ os.path.join(tmp_dir, filename_without_extension)
52
+ ):
53
+ os.makedirs(os.path.join(tmp_dir, filename_without_extension))
54
  image_pixmap.save(
55
  os.path.join(
56
  tmp_dir, filename_without_extension, f"page-{page_num}.png"