gosign commited on
Commit
def4fb5
·
verified ·
1 Parent(s): 93bc402

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -147,7 +147,9 @@ def fetch_image(bucket_name: str, image_path: str):
147
  # Use python-magic to detect MIME type from the file data
148
  mime_type = magic.Magic(mime=True).from_buffer(file_data)
149
 
150
- current_directory = os.getcwd()
 
 
151
 
152
  letterhead_image_path = image_path.split('/')[-1] + "." + mime_type.split('/')[-1]
153
  full_letterhead_image_path = os.path.join(current_directory, "letterhead", letterhead_image_path)
 
147
  # Use python-magic to detect MIME type from the file data
148
  mime_type = magic.Magic(mime=True).from_buffer(file_data)
149
 
150
+ current_directory = os.path.dirname(os.path.abspath(__file__))
151
+
152
+ os.makedirs('letterhead', exist_ok=True)
153
 
154
  letterhead_image_path = image_path.split('/')[-1] + "." + mime_type.split('/')[-1]
155
  full_letterhead_image_path = os.path.join(current_directory, "letterhead", letterhead_image_path)