Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -62,6 +62,7 @@ def generate_profile():
|
|
62 |
pfp = Image.open("fallback.png").convert("RGBA")
|
63 |
print("Using fallback profile picture.")
|
64 |
|
|
|
65 |
pfp = pfp.resize((pfp_size, pfp_size), Image.LANCZOS)
|
66 |
pfp.save(pfp_path) # Save before using
|
67 |
print(f"Profile picture saved at {pfp_path}")
|
@@ -111,9 +112,11 @@ def generate_profile():
|
|
111 |
# Send and delete image
|
112 |
response = send_file(output_path, mimetype='image/png')
|
113 |
|
114 |
-
# Cleanup saved files
|
115 |
-
os.
|
116 |
-
|
|
|
|
|
117 |
|
118 |
return response
|
119 |
|
|
|
62 |
pfp = Image.open("fallback.png").convert("RGBA")
|
63 |
print("Using fallback profile picture.")
|
64 |
|
65 |
+
# Resize and save profile picture
|
66 |
pfp = pfp.resize((pfp_size, pfp_size), Image.LANCZOS)
|
67 |
pfp.save(pfp_path) # Save before using
|
68 |
print(f"Profile picture saved at {pfp_path}")
|
|
|
112 |
# Send and delete image
|
113 |
response = send_file(output_path, mimetype='image/png')
|
114 |
|
115 |
+
# Cleanup saved files safely
|
116 |
+
if os.path.exists(output_path):
|
117 |
+
os.remove(output_path)
|
118 |
+
if os.path.exists(pfp_path):
|
119 |
+
os.remove(pfp_path)
|
120 |
|
121 |
return response
|
122 |
|