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;
|