sitatech commited on
Commit
8347b69
·
1 Parent(s): 985b533

Create parent dir before saving

Browse files
Files changed (1) hide show
  1. utils.py +1 -0
utils.py CHANGED
@@ -28,6 +28,7 @@ class ImageUploader:
28
 
29
  unique_filename = f"{os.urandom(8).hex()}_{filename}"
30
  file_path = f"/tmp/vibe-shopping-public/{unique_filename}"
 
31
  with open(file_path, "wb") as f:
32
  f.write(image)
33
 
 
28
 
29
  unique_filename = f"{os.urandom(8).hex()}_{filename}"
30
  file_path = f"/tmp/vibe-shopping-public/{unique_filename}"
31
+ os.makedirs(os.path.dirname(file_path), exist_ok=True)
32
  with open(file_path, "wb") as f:
33
  f.write(image)
34