Spaces:
Runtime error
Runtime error
keep copy with simple id name
Browse files
stablediffusion-infinity/app.py
CHANGED
@@ -373,8 +373,11 @@ async def upload_file(image: Image.Image, prompt: str, room_id: str, image_key:
|
|
373 |
date = int(time.time())
|
374 |
prompt_slug = slugify(prompt)
|
375 |
filename = f"{date}-{id}-{image_key}-{prompt_slug}.webp"
|
376 |
-
|
377 |
-
|
|
|
|
|
|
|
378 |
temp_file.close()
|
379 |
|
380 |
out = {"url": f'https://d26smi9133w0oo.cloudfront.net/{room_id}/{filename}',
|
|
|
373 |
date = int(time.time())
|
374 |
prompt_slug = slugify(prompt)
|
375 |
filename = f"{date}-{id}-{image_key}-{prompt_slug}.webp"
|
376 |
+
timelapse_name = f"{id}.webp"
|
377 |
+
key_name = f"{room_id}/{filename}"
|
378 |
+
s3.upload_fileobj(Fileobj=temp_file, Bucket=AWS_S3_BUCKET_NAME, Key=key_name, ExtraArgs={"ContentType": "image/webp", "CacheControl": "max-age=31536000"})
|
379 |
+
s3.copy_object(Bucket=AWS_S3_BUCKET_NAME, CopySource=f"{AWS_S3_BUCKET_NAME}/{key_name}", Key=f"timelapse/{room_id}/{timelapse_name}")
|
380 |
+
|
381 |
temp_file.close()
|
382 |
|
383 |
out = {"url": f'https://d26smi9133w0oo.cloudfront.net/{room_id}/{filename}',
|