albumup commited on
Commit
4e6a36f
·
verified ·
1 Parent(s): 7911294

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -182,9 +182,9 @@ async def create_album(
182
  try:
183
  # Create a blank image with the file content as text
184
  img = Image.new('RGB', (200, 200), color=(73, 109, 137))
185
- img.save("temp.png")
186
- with open("temp.png", "rb") as img_file:
187
- file_content = img_file.read()
188
  file.content_type = "image/png"
189
  except Exception as e:
190
  print(f"Error converting file to PNG: {str(e)}")
 
182
  try:
183
  # Create a blank image with the file content as text
184
  img = Image.new('RGB', (200, 200), color=(73, 109, 137))
185
+ img_byte_arr = io.BytesIO()
186
+ img.save(img_byte_arr, format='PNG')
187
+ file_content = img_byte_arr.getvalue()
188
  file.content_type = "image/png"
189
  except Exception as e:
190
  print(f"Error converting file to PNG: {str(e)}")