Spaces:
Running
Running
Create parent dir before saving
Browse files
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 |
|