Spaces:
Sleeping
Sleeping
Samuel Thomas
commited on
Commit
·
a430e55
1
Parent(s):
ad1ff94
write directory for temp
Browse files
tools.py
CHANGED
@@ -72,7 +72,8 @@ def write_bytes_to_temp_dir(file_bytes: bytes, file_name: str) -> str:
|
|
72 |
Returns the full path to the saved file.
|
73 |
The file will persist until manually deleted or the OS cleans the temp directory.
|
74 |
"""
|
75 |
-
temp_dir =
|
|
|
76 |
file_path = os.path.join(temp_dir, file_name)
|
77 |
with open(file_path, 'wb') as f:
|
78 |
f.write(file_bytes)
|
|
|
72 |
Returns the full path to the saved file.
|
73 |
The file will persist until manually deleted or the OS cleans the temp directory.
|
74 |
"""
|
75 |
+
temp_dir = "/tmp" # /tmp is always writable in Hugging Face Spaces
|
76 |
+
os.makedirs(temp_dir, exist_ok=True)
|
77 |
file_path = os.path.join(temp_dir, file_name)
|
78 |
with open(file_path, 'wb') as f:
|
79 |
f.write(file_bytes)
|