Update app.py
Browse files
app.py
CHANGED
|
@@ -1,177 +1,156 @@
|
|
| 1 |
-
import requests
|
| 2 |
-
from bs4 import BeautifulSoup
|
| 3 |
import gradio as gr
|
| 4 |
-
import
|
| 5 |
-
import
|
| 6 |
-
from
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
#
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
""
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
)
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
return
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
#############################
|
| 93 |
-
# ๋ธ๋ก๊ทธ ์์ฑ ๊ธฐ๋ฅ (ChatGPT ๊ธฐ๋ฐ)
|
| 94 |
-
#############################
|
| 95 |
-
OPENAI_SYSTEM_MESSAGE = """๋ฐ๋์ ํ๊ธ๋ก ๋ต๋ณํ ๊ฒ.
|
| 96 |
-
๋๋ ์ต๊ณ ์ ๋น์์ด๋ค.
|
| 97 |
-
๋ด๊ฐ ์๊ตฌํ๋ ๊ฒ๋ค์ ์ต๋ํ ์์ธํ๊ณ ์ ํํ๊ฒ ๋ต๋ณํ๋ผ.
|
| 98 |
-
##[๊ธฐ๋ณธ๊ท์น]
|
| 99 |
-
1. ๋ฐ๋์ ํ๊ตญ์ด(ํ๊ธ)๋ก ์์ฑํ๋ผ.
|
| 100 |
-
2. ๋๋ ๊ฐ์ฅ ์ฃผ๋ชฉ๋ฐ๋ ๋ง์ผํฐ์ด๋ฉฐ ๋ธ๋ก๊ทธ ๋ง์ผํ
์ ๋ฌธ๊ฐ์ด๋ค.
|
| 101 |
-
3. ํนํ ๋๋ '์ ๋ณด์ฑ(Informative)' ์ ๋ฌธ ๋ธ๋ก๊ทธ ๋ง์ผํ
์ ๋ฌธ๊ฐ์ด๋ค.
|
| 102 |
-
4. ์ ๋ณด ์ ๊ณต์ ์ด์ ์ ๋ง์ถ์ด ์์ฑํ๋ค.
|
| 103 |
-
##[ํ
์คํธ ์์ฑ ๊ท์น]
|
| 104 |
-
1. ์์ฃผ์ ๋ฅผ 5๊ฐ๋ก ๊ตฌ๋ถํ์ฌ 2000์ ์ด์๋๋๋ก ์์ฑํ๋ผ.
|
| 105 |
-
2. ์ ์ฒด ๋งฅ๋ฝ์ ์ดํดํ๊ณ ๋ฌธ์ฅ์ ์ผ๊ด์ฑ์ ์ ์งํ๋ผ.
|
| 106 |
-
3. ์ ๋๋ก ์ฐธ๊ณ ๊ธ์ ํ๋ฌธ์ฅ ์ด์ ๊ทธ๋๋ก ์ถ๋ ฅํ์ง ๋ง ๊ฒ.
|
| 107 |
-
4. ์ฃผ์ ์ ์ํฉ์ ๋ง๋ ์ ์ ํ ์ดํ๋ฅผ ์ ํํ๋ผ.
|
| 108 |
-
5. ํ๊ธ ์ดํ์ ๋์ด๋๋ ์ฝ๊ฒ ์์ฑํ๋ผ.
|
| 109 |
-
6. ์ ๋ ๋ฌธ์ฅ์ ๋์ '๋ต๋๋ค'๋ฅผ ์ฌ์ฉํ์ง ๋ง ๊ฒ.
|
| 110 |
-
###[์ ๋ณด์ฑ ๋ธ๋ก๊ทธ ์์ฑ ๊ท์น]
|
| 111 |
-
1. ๋
์๊ฐ ์ป๊ณ ์ ํ๋ ์ ์ฉํ ์ ๋ณด์ ํฅ๋ฏธ๋ก์ด ์ ๋ณด๋ฅผ ์ ๊ณตํ๋๋ก ์์ฑํ๋ผ.
|
| 112 |
-
2. ๋
์์ ๊ณต๊ฐ์ ์ด๋์ด๋ด๊ณ ๊ถ๊ธ์ฆ์ ํด๊ฒฐํ๋๋ก ์์ฑํ๋ผ.
|
| 113 |
-
3. ๋
์์ ๊ด์ฌ์ฌ๋ฅผ ์ถฉ์กฑ์ํค๋๋ก ์์ฑํ๋ผ.
|
| 114 |
-
4. ๋
์์๊ฒ ์ด๋์ด ๋๋ ์ ๋ณด๋ฅผ ์์ฑํ๋ผ.
|
| 115 |
-
##[์ ์ธ ๊ท์น]
|
| 116 |
-
1. ๋ฐ๋์ ๋น์์ด ๋ฐ ์์ค(expletive, abusive language, slang)์ ์ ์ธํ๋ผ.
|
| 117 |
-
2. ๋ฐ๋์ ์ฐธ๊ณ ๊ธ์ ๋งํฌ(URL)๋ ์ ์ธํ๋ผ.
|
| 118 |
-
3. ์ฐธ๊ณ ๊ธ์์ '๋งํฌ๋ฅผ ํ์ธํด์ฃผ์ธ์'์ ๊ฐ์ ๋งํฌ ์ด๋์ ๋ฌธ๊ตฌ๋ ์ ์ธํ๋ผ.
|
| 119 |
-
4. ์ฐธ๊ณ ๊ธ์ ์๋ ์์ฑ์, ํ์, ์ ํ๋ฒ, ๊ธฐ์์ ์ด๋ฆ, ์ ์นญ, ๋๋ค์์ ๋ฐ๋์ ์ ์ธํ๋ผ.
|
| 120 |
-
5. ๋ฐ๋์ ๋ฌธ์ฅ์ ๋๋ถ๋ถ์ด ์ด์ํ ํ๊ตญ์ด ํํ์ ์ ์ธํ๋ผ('์์', '๋ต๋๋ค', 'ํด์', 'ํด์ฃผ์ฃ ', '๋์ฃ ', '๋์ด์', '๊ณ ์' ๋ฑ.)
|
| 121 |
-
"""
|
| 122 |
-
|
| 123 |
-
OPENAI_MAX_TOKENS = 4000
|
| 124 |
-
OPENAI_TEMPERATURE = 0.7
|
| 125 |
-
OPENAI_TOP_P = 0.95
|
| 126 |
-
|
| 127 |
-
def generate_blog(tone_value: str, ref1_value: str, ref2_value: str, ref3_value: str) -> str:
|
| 128 |
"""
|
| 129 |
-
|
| 130 |
"""
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
)
|
| 144 |
-
return response
|
| 145 |
-
|
| 146 |
-
#############################
|
| 147 |
# Gradio ์ธํฐํ์ด์ค (ํญ ๊ตฌ์ฑ)
|
| 148 |
-
#############################
|
| 149 |
-
with gr.Blocks() as
|
| 150 |
-
gr.Markdown("#
|
| 151 |
-
|
|
|
|
| 152 |
with gr.Tabs():
|
| 153 |
-
#
|
| 154 |
-
with gr.TabItem("
|
| 155 |
-
gr.
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
)
|
| 169 |
-
ref1 = gr.Textbox(label="์ฐธ์กฐ๊ธ 1")
|
| 170 |
-
ref2 = gr.Textbox(label="์ฐธ์กฐ๊ธ 2")
|
| 171 |
-
ref3 = gr.Textbox(label="์ฐธ์กฐ๊ธ 3")
|
| 172 |
-
blog_output = gr.Textbox(label="์์ฑ๋ ๋ธ๋ก๊ทธ", lines=20, interactive=False)
|
| 173 |
-
generate_button = gr.Button("์์ฑํ๊ธฐ")
|
| 174 |
-
generate_button.click(fn=generate_blog, inputs=[tone_radio, ref1, ref2, ref3], outputs=blog_output)
|
| 175 |
|
| 176 |
-
|
| 177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import cv2
|
| 3 |
+
import numpy as np
|
| 4 |
+
from PIL import Image, ImageEnhance, ImageDraw, ImageFont
|
| 5 |
+
from gradio_imageslider import ImageSlider
|
| 6 |
+
|
| 7 |
+
######################################
|
| 8 |
+
# ํํฐ ์ ์ฉ ๊ด๋ จ ํจ์๋ค
|
| 9 |
+
######################################
|
| 10 |
+
def apply_filter(image, filter_type, intensity):
|
| 11 |
+
image = np.array(image)
|
| 12 |
+
normalized_intensity = intensity / 100.0
|
| 13 |
+
|
| 14 |
+
if filter_type == "Grayscale":
|
| 15 |
+
return convert_to_grayscale(image)
|
| 16 |
+
elif filter_type == "Soft Glow":
|
| 17 |
+
base_intensity = 0.1
|
| 18 |
+
adjusted_intensity = base_intensity + (normalized_intensity * (1 - base_intensity))
|
| 19 |
+
gaussian = cv2.GaussianBlur(image, (15, 15), 0)
|
| 20 |
+
soft_glow = cv2.addWeighted(image, 1 - adjusted_intensity, gaussian, adjusted_intensity, 0)
|
| 21 |
+
return soft_glow
|
| 22 |
+
elif filter_type == "Portrait Enhancer":
|
| 23 |
+
base_intensity = 0.5
|
| 24 |
+
adjusted_intensity = base_intensity + (normalized_intensity * (1 - base_intensity))
|
| 25 |
+
image_pil = Image.fromarray(image)
|
| 26 |
+
enhancer = ImageEnhance.Sharpness(image_pil)
|
| 27 |
+
image_pil = enhancer.enhance(1 + 0.5 * adjusted_intensity)
|
| 28 |
+
enhancer = ImageEnhance.Color(image_pil)
|
| 29 |
+
image_pil = enhancer.enhance(1 + 0.5 * adjusted_intensity)
|
| 30 |
+
enhanced_image = np.array(image_pil)
|
| 31 |
+
return enhanced_image
|
| 32 |
+
elif filter_type == "Warm Tone":
|
| 33 |
+
warm_image = cv2.addWeighted(image, 1.0, np.full(image.shape, (20, 66, 112), dtype=np.uint8), 0.3 * normalized_intensity, 0)
|
| 34 |
+
return warm_image
|
| 35 |
+
elif filter_type == "Cold Tone":
|
| 36 |
+
cold_image = cv2.addWeighted(image, 1.0, np.full(image.shape, (112, 66, 20), dtype=np.uint8), 0.3 * normalized_intensity, 0)
|
| 37 |
+
return cold_image
|
| 38 |
+
elif filter_type == "High-Key":
|
| 39 |
+
high_key = cv2.convertScaleAbs(image, alpha=1.0 + 0.3 * normalized_intensity, beta=20)
|
| 40 |
+
return high_key
|
| 41 |
+
elif filter_type == "Low-Key":
|
| 42 |
+
low_key = cv2.convertScaleAbs(image, alpha=1.0 - 0.1 * normalized_intensity, beta=-10)
|
| 43 |
+
return low_key
|
| 44 |
+
elif filter_type == "Haze":
|
| 45 |
+
haze = cv2.addWeighted(image, 1.0, np.full(image.shape, 255, dtype=np.uint8), 0.3 * normalized_intensity, 0)
|
| 46 |
+
return haze
|
| 47 |
+
else:
|
| 48 |
+
return image
|
| 49 |
+
|
| 50 |
+
def convert_to_grayscale(image):
|
| 51 |
+
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
| 52 |
+
return cv2.cvtColor(gray_image, cv2.COLOR_GRAY2BGR)
|
| 53 |
+
|
| 54 |
+
def convert_and_save(image, filter_type, intensity):
|
| 55 |
+
# OpenCV ์ฒ๋ฆฌ๋ฅผ ์ํด RGB -> BGR ๋ณํ
|
| 56 |
+
image_cv = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)
|
| 57 |
+
filtered_image = apply_filter(image_cv, filter_type, intensity)
|
| 58 |
+
|
| 59 |
+
# ์ฌ๋ผ์ด๋ ๋น๊ต์ฉ ์๋ณธ, ํํฐ ์ ์ฉ ์ด๋ฏธ์ง (BGR -> RGB)
|
| 60 |
+
original_image_pil = Image.fromarray(cv2.cvtColor(image_cv, cv2.COLOR_BGR2RGB))
|
| 61 |
+
filtered_image_pil = Image.fromarray(cv2.cvtColor(filtered_image, cv2.COLOR_BGR2RGB))
|
| 62 |
+
|
| 63 |
+
# ๋ค์ด๋ก๋์ฉ ํ์ผ ์ ์ฅ (JPEG ํ์)
|
| 64 |
+
output_path = "filtered_image.jpg"
|
| 65 |
+
filtered_image_pil.save(output_path)
|
| 66 |
+
|
| 67 |
+
# ์ถ๊ฐ: ํํฐ ์ ์ฉ ์ด๋ฏธ์ง์ ํ๋ฐฑ(Grayscale) ๋ฒ์ ์์ฑ
|
| 68 |
+
grayscale_image = convert_to_grayscale(filtered_image)
|
| 69 |
+
grayscale_image_pil = Image.fromarray(cv2.cvtColor(grayscale_image, cv2.COLOR_BGR2RGB))
|
| 70 |
+
|
| 71 |
+
return [original_image_pil, filtered_image_pil], output_path, grayscale_image_pil
|
| 72 |
+
|
| 73 |
+
def get_filter_description(filter_type):
|
| 74 |
+
descriptions = {
|
| 75 |
+
"Grayscale": "์ด๋ฏธ์ง๋ฅผ ํ๋ฐฑ์ผ๋ก ๋ณํํฉ๋๋ค.",
|
| 76 |
+
"Soft Glow": "๋ถ๋๋ฌ์ด ๋น์ ์ถ๊ฐํ์ฌ ์ด๋ฏธ์ง๋ฅผ ์์ํ๊ฒ ๋ง๋ญ๋๋ค.",
|
| 77 |
+
"Portrait Enhancer": "ํผ๋ถ ํค์ ๊ท ์ผํ๊ฒ ํ๊ณ ์ ๋ช
๋๋ฅผ ์กฐ์ ํ์ฌ ์ธ๋ฌผ์ ๋์ฑ ๋๋ณด์ด๊ฒ ๋ง๋ญ๋๋ค.",
|
| 78 |
+
"Warm Tone": "๋ฐ๋ปํ ์์กฐ๋ฅผ ์ถ๊ฐํ์ฌ ์ด๋ฏธ์ง์ ์จ๊ธฐ๋ฅผ ๋ํฉ๋๋ค.",
|
| 79 |
+
"Cold Tone": "์ฐจ๊ฐ์ด ์์กฐ๋ฅผ ์ถ๊ฐํ์ฌ ์ด๋ฏธ์ง์ ์์ํจ์ ๋ํฉ๋๋ค.",
|
| 80 |
+
"High-Key": "๋ฐ๊ณ ํ์ฌํ ์ด๋ฏธ์ง๋ฅผ ๋ง๋ค์ด๋
๋๋ค.",
|
| 81 |
+
"Low-Key": "์ด๋์ด ํค์ ๊ฐ์กฐํ์ฌ ๋ถ์๊ธฐ ์๋ ์ด๋ฏธ์ง๋ฅผ ๋ง๋ญ๋๋ค.",
|
| 82 |
+
"Haze": "๋ถ๋๋ฝ๊ณ ํ๋ฆฟํ ํจ๊ณผ๋ฅผ ์ถ๊ฐํ์ฌ ๋ชฝํ์ ์ธ ์ด๋ฏธ์ง๋ฅผ ๋ง๋ญ๋๋ค."
|
| 83 |
+
}
|
| 84 |
+
return descriptions.get(filter_type, "")
|
| 85 |
+
|
| 86 |
+
######################################
|
| 87 |
+
# ์ด๋ฏธ์ง ๋ฉ์ดํน ๊ด๋ จ ํจ์
|
| 88 |
+
######################################
|
| 89 |
+
def generate_custom_image(width, height, bg_color, text):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
"""
|
| 91 |
+
์ฃผ์ด์ง ํฌ๊ธฐ์ ๋ฐฐ๊ฒฝ์, ๊ทธ๋ฆฌ๊ณ ํ
์คํธ๋ฅผ ์ด์ฉํด ์ด๋ฏธ์ง๋ฅผ ์์ฑํ๋ ํจ์.
|
| 92 |
"""
|
| 93 |
+
# PIL์์ bg_color๋ ์ผ๋ฐ์ ์ผ๋ก hex ์ฝ๋๋ ํํ(R,G,B)๋ก ์ฌ์ฉ๋ฉ๋๋ค.
|
| 94 |
+
# gr.ColorPicker๋ hex ์ฝ๋ ํํ๋ก ๊ฐ์ ์ ๊ณตํฉ๋๋ค.
|
| 95 |
+
image = Image.new("RGB", (width, height), bg_color)
|
| 96 |
+
if text:
|
| 97 |
+
draw = ImageDraw.Draw(image)
|
| 98 |
+
font = ImageFont.load_default()
|
| 99 |
+
text_size = draw.textsize(text, font=font)
|
| 100 |
+
text_position = ((width - text_size[0]) / 2, (height - text_size[1]) / 2)
|
| 101 |
+
draw.text(text_position, text, font=font, fill="black")
|
| 102 |
+
return image
|
| 103 |
+
|
| 104 |
+
######################################
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
# Gradio ์ธํฐํ์ด์ค (ํญ ๊ตฌ์ฑ)
|
| 106 |
+
######################################
|
| 107 |
+
with gr.Blocks() as iface:
|
| 108 |
+
gr.Markdown("# ์ด๋ฏธ์ง ์ฒ๋ฆฌ ๋๊ตฌ")
|
| 109 |
+
gr.Markdown("์ธ๋ฌผ ์ฌ์ง ํํฐ์ ์ด๋ฏธ์ง ๋ฉ์ดํน ๊ธฐ๋ฅ์ ์ ๊ณตํฉ๋๋ค.")
|
| 110 |
+
|
| 111 |
with gr.Tabs():
|
| 112 |
+
# ํญ 1: ์ธ๋ฌผ ์ฌ์ง ํํฐ
|
| 113 |
+
with gr.TabItem("์ธ๋ฌผ ์ฌ์ง ํํฐ"):
|
| 114 |
+
with gr.Row():
|
| 115 |
+
with gr.Column():
|
| 116 |
+
image_input = gr.Image(type="pil", label="์ด๋ฏธ์ง ์
๋ก๋")
|
| 117 |
+
filter_input = gr.Radio(
|
| 118 |
+
["Grayscale", "Soft Glow", "Portrait Enhancer", "Warm Tone", "Cold Tone", "High-Key", "Low-Key", "Haze"],
|
| 119 |
+
label="ํํฐ ์ ํ",
|
| 120 |
+
value="Soft Glow"
|
| 121 |
+
)
|
| 122 |
+
intensity_slider = gr.Slider(1, 100, value=50, label="ํํฐ ๊ฐ๋")
|
| 123 |
+
description_output = gr.Markdown(get_filter_description("Soft Glow"))
|
| 124 |
+
with gr.Column():
|
| 125 |
+
slider_output = ImageSlider(label="Before and After", type="pil")
|
| 126 |
+
download_link = gr.File(label="Download Filtered Image")
|
| 127 |
+
grayscale_output = gr.Image(label="Grayscale Output")
|
| 128 |
+
filter_input.change(fn=get_filter_description, inputs=filter_input, outputs=description_output)
|
| 129 |
+
process_button = gr.Button("ํํฐ ์ ์ฉ")
|
| 130 |
+
process_button.click(
|
| 131 |
+
fn=convert_and_save,
|
| 132 |
+
inputs=[image_input, filter_input, intensity_slider],
|
| 133 |
+
outputs=[slider_output, download_link, grayscale_output]
|
| 134 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
+
# ํญ 2: ์ด๋ฏธ์ง ๋ฉ์ดํน
|
| 137 |
+
with gr.TabItem("์ด๋ฏธ์ง ๋ฉ์ดํน"):
|
| 138 |
+
with gr.Row():
|
| 139 |
+
with gr.Column():
|
| 140 |
+
width_slider = gr.Slider(100, 1000, value=500, label="๊ฐ๋ก ํฌ๊ธฐ")
|
| 141 |
+
height_slider = gr.Slider(100, 1000, value=500, label="์ธ๋ก ํฌ๊ธฐ")
|
| 142 |
+
bg_color_picker = gr.ColorPicker(value="#FFFFFF", label="๋ฐฐ๊ฒฝ ์์")
|
| 143 |
+
text_input = gr.Textbox(label="ํ
์คํธ (์ต์
)", placeholder="์ด๋ฏธ์ง์ ์ฝ์
ํ ํ
์คํธ")
|
| 144 |
+
generate_image_button = gr.Button("์ด๋ฏธ์ง ์์ฑ")
|
| 145 |
+
with gr.Column():
|
| 146 |
+
image_output = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง", type="pil")
|
| 147 |
+
generate_image_button.click(
|
| 148 |
+
fn=generate_custom_image,
|
| 149 |
+
inputs=[width_slider, height_slider, bg_color_picker, text_input],
|
| 150 |
+
outputs=image_output
|
| 151 |
+
)
|
| 152 |
+
|
| 153 |
+
iface.title = "์ด๋ฏธ์ง ์ฒ๋ฆฌ ๋๊ตฌ"
|
| 154 |
+
iface.description = "์ธ๋ฌผ ์ฌ์ง ํํฐ์ ์ด๋ฏธ์ง ๋ฉ์ดํน ๊ธฐ๋ฅ์ ์ ๊ณตํฉ๋๋ค."
|
| 155 |
+
|
| 156 |
+
iface.launch()
|