Spaces:
Running
on
Zero
Running
on
Zero
bugfix
Browse files
app.py
CHANGED
@@ -60,7 +60,7 @@ class calculateDuration:
|
|
60 |
def upload_image_to_r2(image, account_id, access_key, secret_key, bucket_name):
|
61 |
print("upload_image_to_r2", account_id, access_key, secret_key, bucket_name)
|
62 |
connectionUrl = f"https://{account_id}.r2.cloudflarestorage.com"
|
63 |
-
|
64 |
s3 = boto3.client(
|
65 |
's3',
|
66 |
endpoint_url=connectionUrl,
|
@@ -72,7 +72,7 @@ def upload_image_to_r2(image, account_id, access_key, secret_key, bucket_name):
|
|
72 |
current_time = datetime.now().strftime("%Y/%m/%d/%H%M%S")
|
73 |
image_file = f"generated_images/{current_time}_{random.randint(0, MAX_SEED)}.png"
|
74 |
buffer = BytesIO()
|
75 |
-
|
76 |
buffer.seek(0)
|
77 |
s3.upload_fileobj(buffer, bucket_name, image_file)
|
78 |
print("upload finish", image_file)
|
|
|
60 |
def upload_image_to_r2(image, account_id, access_key, secret_key, bucket_name):
|
61 |
print("upload_image_to_r2", account_id, access_key, secret_key, bucket_name)
|
62 |
connectionUrl = f"https://{account_id}.r2.cloudflarestorage.com"
|
63 |
+
img = Image.fromarray(image)
|
64 |
s3 = boto3.client(
|
65 |
's3',
|
66 |
endpoint_url=connectionUrl,
|
|
|
72 |
current_time = datetime.now().strftime("%Y/%m/%d/%H%M%S")
|
73 |
image_file = f"generated_images/{current_time}_{random.randint(0, MAX_SEED)}.png"
|
74 |
buffer = BytesIO()
|
75 |
+
img.save(buffer, "PNG")
|
76 |
buffer.seek(0)
|
77 |
s3.upload_fileobj(buffer, bucket_name, image_file)
|
78 |
print("upload finish", image_file)
|