Spaces:
Sleeping
Sleeping
drakosfire
commited on
Commit
•
f2f783c
1
Parent(s):
e220a4f
Fixing u.delete_files, I think it's a permissions problem
Browse files- app.py +1 -1
- utilities.py +9 -8
app.py
CHANGED
@@ -298,7 +298,7 @@ with gr.Blocks() as demo:
|
|
298 |
item_quote_output
|
299 |
],
|
300 |
outputs = generate_gallery )
|
301 |
-
list_of_static_dir = ["./card_parts/", " ./fonts/"]
|
302 |
gr.set_static_paths(paths=list_of_static_dir)
|
303 |
|
304 |
|
|
|
298 |
item_quote_output
|
299 |
],
|
300 |
outputs = generate_gallery )
|
301 |
+
list_of_static_dir = ["./card_parts/", " ./fonts/", "./image_temp"]
|
302 |
gr.set_static_paths(paths=list_of_static_dir)
|
303 |
|
304 |
|
utilities.py
CHANGED
@@ -20,15 +20,16 @@ def directory_contents(directory_path):
|
|
20 |
|
21 |
# Delete a list of file
|
22 |
def delete_files(file_paths):
|
|
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
|
33 |
def open_image_from_url(image_url):
|
34 |
response = requests.get(image_url)
|
|
|
20 |
|
21 |
# Delete a list of file
|
22 |
def delete_files(file_paths):
|
23 |
+
if file_paths:
|
24 |
|
25 |
+
for file_path in file_paths:
|
26 |
+
try:
|
27 |
+
os.remove(f"./image_temp/{file_path}")
|
28 |
+
print(f"Remove : ./image_temp/{file_path}")
|
29 |
+
except OSError as e:
|
30 |
+
print(f"Error: {file_path} : {e.strerror}")
|
31 |
+
file_paths.clear()
|
32 |
+
|
33 |
|
34 |
def open_image_from_url(image_url):
|
35 |
response = requests.get(image_url)
|