Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,15 @@ def upload_to_imgur(image_data):
|
|
25 |
logger.debug(f"Image data type: {type(image_data)}")
|
26 |
logger.debug(f"Image data length: {len(image_data)}")
|
27 |
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
url = "https://api.imgur.com/3/image"
|
31 |
payload = {'image': im_b64, 'type': 'base64'}
|
@@ -102,7 +110,6 @@ def respond(message, seed, randomize_seed, width, height, guidance_scale, num_in
|
|
102 |
# ... (나머지 코드는 그대로 유지)
|
103 |
|
104 |
|
105 |
-
|
106 |
css = """
|
107 |
footer {
|
108 |
visibility: hidden;
|
|
|
25 |
logger.debug(f"Image data type: {type(image_data)}")
|
26 |
logger.debug(f"Image data length: {len(image_data)}")
|
27 |
|
28 |
+
# 이미지 데이터를 PIL Image 객체로 변환
|
29 |
+
image = Image.open(io.BytesIO(image_data))
|
30 |
+
|
31 |
+
# PNG 형식으로 변환
|
32 |
+
buffered = io.BytesIO()
|
33 |
+
image.save(buffered, format="PNG")
|
34 |
+
|
35 |
+
# Base64로 인코딩
|
36 |
+
im_b64 = base64.b64encode(buffered.getvalue()).decode("utf-8")
|
37 |
|
38 |
url = "https://api.imgur.com/3/image"
|
39 |
payload = {'image': im_b64, 'type': 'base64'}
|
|
|
110 |
# ... (나머지 코드는 그대로 유지)
|
111 |
|
112 |
|
|
|
113 |
css = """
|
114 |
footer {
|
115 |
visibility: hidden;
|