Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -65,28 +65,11 @@ def cleanup_session_files(request: gr.Request):
|
|
65 |
# Get the session ID from the request
|
66 |
session_id = request.session_hash
|
67 |
|
68 |
-
#
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
]
|
74 |
-
|
75 |
-
files_cleaned = 0
|
76 |
-
|
77 |
-
# Clean session directories in gradio temp folders
|
78 |
-
for temp_dir in gradio_temp_dirs:
|
79 |
-
session_dir = os.path.join(temp_dir, session_id)
|
80 |
-
if os.path.exists(session_dir):
|
81 |
-
try:
|
82 |
-
shutil.rmtree(session_dir)
|
83 |
-
files_cleaned += 1
|
84 |
-
print(f"Cleaned up session directory: {session_dir}")
|
85 |
-
except (OSError, FileNotFoundError):
|
86 |
-
pass
|
87 |
-
|
88 |
-
if files_cleaned > 0:
|
89 |
-
print(f"Session cleanup completed: {files_cleaned} directories removed for session {session_id}")
|
90 |
|
91 |
except Exception as e:
|
92 |
print(f"Error during session cleanup: {e}")
|
|
|
65 |
# Get the session ID from the request
|
66 |
session_id = request.session_hash
|
67 |
|
68 |
+
# Clean up the session directory
|
69 |
+
session_dir = os.path.join("/tmp/gradio", session_id)
|
70 |
+
if os.path.exists(session_dir):
|
71 |
+
shutil.rmtree(session_dir)
|
72 |
+
print(f"Cleaned up session directory: {session_dir}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
except Exception as e:
|
75 |
print(f"Error during session cleanup: {e}")
|