Update app.py
Browse files
app.py
CHANGED
|
@@ -1,533 +1,98 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 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 |
-
|
| 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 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
translated_text = translated_text.replace("IMAGE_TAG_TWO", "#2")
|
| 100 |
-
translated_text = translated_text.replace("IMAGE_TAG_THREE", "#3")
|
| 101 |
-
logger.info(f"Translated text: {translated_text.strip()}")
|
| 102 |
-
return translated_text.strip()
|
| 103 |
-
else:
|
| 104 |
-
logger.warning("๋ฒ์ญ ๊ฒฐ๊ณผ๊ฐ ์์ต๋๋ค. ์๋ณธ ํ๋กฌํํธ ์ฌ์ฉ")
|
| 105 |
-
# ์์ ํ ํฐ์ ์๋ ํ๊ทธ๋ก ๋ณต์
|
| 106 |
-
prompt = prompt.replace("IMAGE_TAG_ONE", "#1")
|
| 107 |
-
prompt = prompt.replace("IMAGE_TAG_TWO", "#2")
|
| 108 |
-
prompt = prompt.replace("IMAGE_TAG_THREE", "#3")
|
| 109 |
-
return prompt
|
| 110 |
-
except Exception as e:
|
| 111 |
-
logger.exception("๋ฒ์ญ ์ค ์ค๋ฅ ๋ฐ์:")
|
| 112 |
-
# ์์ ํ ํฐ์ ์๋ ํ๊ทธ๋ก ๋ณต์
|
| 113 |
-
prompt = prompt.replace("IMAGE_TAG_ONE", "#1")
|
| 114 |
-
prompt = prompt.replace("IMAGE_TAG_TWO", "#2")
|
| 115 |
-
prompt = prompt.replace("IMAGE_TAG_THREE", "#3")
|
| 116 |
-
return prompt
|
| 117 |
-
|
| 118 |
-
def preprocess_prompt(prompt, image1, image2, image3):
|
| 119 |
-
"""
|
| 120 |
-
ํ๋กฌํํธ๋ฅผ ์ฒ๋ฆฌํ๊ณ ๊ธฐ๋ฅ ๋ช
๋ น์ ํด์
|
| 121 |
-
"""
|
| 122 |
-
has_img1 = image1 is not None
|
| 123 |
-
has_img2 = image2 is not None
|
| 124 |
-
has_img3 = image3 is not None
|
| 125 |
-
|
| 126 |
-
if "#1" in prompt and not has_img1:
|
| 127 |
-
prompt = prompt.replace("#1", "์ฒซ ๋ฒ์งธ ์ด๋ฏธ์ง(์์)")
|
| 128 |
-
else:
|
| 129 |
-
prompt = prompt.replace("#1", "์ฒซ ๋ฒ์งธ ์ด๋ฏธ์ง")
|
| 130 |
-
|
| 131 |
-
if "#2" in prompt and not has_img2:
|
| 132 |
-
prompt = prompt.replace("#2", "๋ ๏ฟฝ๏ฟฝ์งธ ์ด๋ฏธ์ง(์์)")
|
| 133 |
-
else:
|
| 134 |
-
prompt = prompt.replace("#2", "๋ ๋ฒ์งธ ์ด๋ฏธ์ง")
|
| 135 |
-
|
| 136 |
-
if "#3" in prompt and not has_img3:
|
| 137 |
-
prompt = prompt.replace("#3", "์ธ ๋ฒ์งธ ์ด๋ฏธ์ง(์์)")
|
| 138 |
-
else:
|
| 139 |
-
prompt = prompt.replace("#3", "์ธ ๋ฒ์งธ ์ด๋ฏธ์ง")
|
| 140 |
-
|
| 141 |
-
if "1. ์ด๋ฏธ์ง ๋ณ๊ฒฝ" in prompt:
|
| 142 |
-
desc_match = re.search(r'#1์ "(.*?)"์ผ๋ก ๋ฐ๊ฟ๋ผ', prompt)
|
| 143 |
-
if desc_match:
|
| 144 |
-
description = desc_match.group(1)
|
| 145 |
-
prompt = f"์ฒซ ๋ฒ์งธ ์ด๋ฏธ์ง๋ฅผ {description}์ผ๋ก ๋ณ๊ฒฝํด์ฃผ์ธ์. ์๋ณธ ์ด๋ฏธ์ง์ ์ฃผ์ ๋ด์ฉ์ ์ ์งํ๋ ์๋ก์ด ์คํ์ผ๊ณผ ๋ถ์๊ธฐ๋ก ์ฌํด์ํด์ฃผ์ธ์."
|
| 146 |
-
else:
|
| 147 |
-
prompt = "์ฒซ ๋ฒ์งธ ์ด๋ฏธ์ง๋ฅผ ์ฐฝ์์ ์ผ๋ก ๋ณํํด์ฃผ์ธ์. ๋ ์์ํ๊ณ ์์ ์ ์ธ ๋ฒ์ ์ผ๋ก ๋ง๋ค์ด์ฃผ์ธ์."
|
| 148 |
-
|
| 149 |
-
elif "2. ๊ธ์์ง์ฐ๊ธฐ" in prompt:
|
| 150 |
-
text_match = re.search(r'#1์์ "(.*?)"๋ฅผ ์ง์๋ผ', prompt)
|
| 151 |
-
if text_match:
|
| 152 |
-
text_to_remove = text_match.group(1)
|
| 153 |
-
prompt = f"์ฒซ ๋ฒ์งธ ์ด๋ฏธ์ง์์ '{text_to_remove}' ํ
์คํธ๋ฅผ ์ฐพ์ ์์ฐ์ค๋ฝ๊ฒ ์ ๊ฑฐํด์ฃผ์ธ์. ํ
์คํธ๊ฐ ์๋ ๋ถ๋ถ์ ๋ฐฐ๊ฒฝ๊ณผ ์กฐํ๋กญ๊ฒ ์ฑ์์ฃผ์ธ์."
|
| 154 |
-
else:
|
| 155 |
-
prompt = "์ฒซ ๋ฒ์งธ ์ด๋ฏธ์ง์์ ๋ชจ๋ ํ
์คํธ๋ฅผ ์ฐพ์ ์์ฐ์ค๋ฝ๊ฒ ์ ๊ฑฐํด์ฃผ์ธ์. ๊น๋ํ ์ด๋ฏธ์ง๋ก ๋ง๋ค์ด์ฃผ์ธ์."
|
| 156 |
-
|
| 157 |
-
elif "4. ์ท๋ฐ๊พธ๊ธฐ" in prompt:
|
| 158 |
-
prompt = "์ฒซ ๋ฒ์งธ ์ด๋ฏธ์ง์ ์ธ๋ฌผ ์์์ ๋ ๋ฒ์งธ ์ด๋ฏธ์ง์ ์์์ผ๋ก ๋ณ๊ฒฝํด์ฃผ์ธ์. ์์์ ์คํ์ผ๊ณผ ์์์ ๋ ๋ฒ์งธ ์ด๋ฏธ์ง๋ฅผ ๋ฐ๋ฅด๋, ์ ์ฒด ๋น์จ๊ณผ ํฌ์ฆ๋ ์ฒซ ๋ฒ์งธ ์ด๋ฏธ์ง๋ฅผ ์ ์งํด์ฃผ์ธ์."
|
| 159 |
-
|
| 160 |
-
elif "5. ๋ฐฐ๊ฒฝ๋ฐ๊พธ๊ธฐ" in prompt:
|
| 161 |
-
prompt = "์ฒซ ๋ฒ์งธ ์ด๋ฏธ์ง์ ๋ฐฐ๊ฒฝ์ ๋ ๋ฒ์งธ ์ด๋ฏธ์ง์ ๋ฐฐ๊ฒฝ์ผ๋ก ๋ณ๊ฒฝํด์ฃผ์ธ์. ์ฒซ ๋ฒ์งธ ์ด๋ฏธ์ง์ ์ฃผ์ ํผ์ฌ์ฒด๋ ์ ์งํ๊ณ , ๋ ๋ฒ์งธ ์ด๋ฏธ์ง์ ๋ฐฐ๊ฒฝ๊ณผ ์กฐํ๋กญ๊ฒ ํฉ์ฑํด์ฃผ์ธ์."
|
| 162 |
-
|
| 163 |
-
elif "6. ์ด๋ฏธ์ง ํฉ์ฑ(์ํํฌํจ)" in prompt:
|
| 164 |
-
prompt = "์ฒซ ๋ฒ์งธ ์ด๋ฏธ์ง์ ๋ ๋ฒ์งธ ์ด๋ฏธ์ง(๋๋ ์ธ ๋ฒ์งธ ์ด๋ฏธ์ง)๋ฅผ ์์ฐ์ค๋ฝ๊ฒ ํฉ์ฑํด์ฃผ์ธ์. ๋ชจ๋ ์ด๋ฏธ์ง์ ์ฃผ์ ์์๋ฅผ ํฌํจํ๊ณ , ํนํ ์ํ์ด ๋๋ณด์ด๋๋ก ์กฐํ๋กญ๊ฒ ํตํฉํด์ฃผ์ธ์."
|
| 165 |
-
|
| 166 |
-
prompt += " ์ด๋ฏธ์ง๋ฅผ ์์ฑํด์ฃผ์ธ์. ์ด๋ฏธ์ง์ ํ
์คํธ๋ ๊ธ์๋ฅผ ํฌํจํ์ง ๋ง์ธ์."
|
| 167 |
-
return prompt
|
| 168 |
-
|
| 169 |
-
def generate_with_images(prompt, images, variation_index=0):
|
| 170 |
-
"""
|
| 171 |
-
API ํธ์ถ์ ํตํด ์ด๋ฏธ์ง๋ฅผ ์์ฑํ๊ณ ๊ฒฐ๊ณผ ์ด๋ฏธ์ง๋ฅผ ๋ฐํํฉ๋๋ค.
|
| 172 |
-
variation_index๋ก ๋ค์ํ ๋ณํ๋ฅผ ์ค๋๋ค.
|
| 173 |
-
"""
|
| 174 |
-
try:
|
| 175 |
-
api_key = os.environ.get("GEMINI_API_KEY")
|
| 176 |
-
if not api_key:
|
| 177 |
-
return None, "API ํค๊ฐ ์ค์ ๋์ง ์์์ต๋๋ค. ํ๊ฒฝ๋ณ์๋ฅผ ํ์ธํด์ฃผ์ธ์."
|
| 178 |
-
|
| 179 |
-
client = genai.Client(api_key=api_key)
|
| 180 |
-
logger.info(f"Gemini API ์์ฒญ ์์ - ํ๋กฌํํธ: {prompt}, ๋ณํ ์ธ๋ฑ์ค: {variation_index}")
|
| 181 |
-
|
| 182 |
-
# ๋ณํ ์ธ๋ฑ์ค์ ๋ฐ๋ผ ํ๋กฌํํธ์ ์ฝ๊ฐ์ ๋ณํ ์ถ๊ฐ
|
| 183 |
-
variation_suffixes = [
|
| 184 |
-
" Create this as the first variation. Do not add any text, watermarks, or labels to the image.",
|
| 185 |
-
" Create this as the second variation with more vivid colors. Do not add any text, watermarks, or labels to the image.",
|
| 186 |
-
" Create this as the third variation with a more creative style. Do not add any text, watermarks, or labels to the image.",
|
| 187 |
-
" Create this as the fourth variation with enhanced details. Do not add any text, watermarks, or labels to the image."
|
| 188 |
-
]
|
| 189 |
-
|
| 190 |
-
if variation_index < len(variation_suffixes):
|
| 191 |
-
prompt = prompt + variation_suffixes[variation_index]
|
| 192 |
-
else:
|
| 193 |
-
prompt = prompt + " Do not add any text, watermarks, or labels to the image."
|
| 194 |
-
|
| 195 |
-
contents = [prompt]
|
| 196 |
-
for idx, img in enumerate(images, 1):
|
| 197 |
-
if img is not None:
|
| 198 |
-
contents.append(img)
|
| 199 |
-
logger.info(f"์ด๋ฏธ์ง #{idx} ์ถ๊ฐ๋จ")
|
| 200 |
-
|
| 201 |
-
response = client.models.generate_content(
|
| 202 |
-
model="gemini-2.0-flash-exp-image-generation",
|
| 203 |
-
contents=contents,
|
| 204 |
-
config=types.GenerateContentConfig(
|
| 205 |
-
response_modalities=['Text', 'Image'],
|
| 206 |
-
temperature=1,
|
| 207 |
-
top_p=0.95,
|
| 208 |
-
top_k=40,
|
| 209 |
-
max_output_tokens=8192
|
| 210 |
-
)
|
| 211 |
-
)
|
| 212 |
-
|
| 213 |
-
with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as tmp:
|
| 214 |
-
temp_path = tmp.name
|
| 215 |
-
result_text = ""
|
| 216 |
-
image_found = False
|
| 217 |
-
for part in response.candidates[0].content.parts:
|
| 218 |
-
if hasattr(part, 'text') and part.text:
|
| 219 |
-
result_text += part.text
|
| 220 |
-
logger.info(f"์๋ต ํ
์คํธ: {part.text}")
|
| 221 |
-
elif hasattr(part, 'inline_data') and part.inline_data:
|
| 222 |
-
save_binary_file(temp_path, part.inline_data.data)
|
| 223 |
-
image_found = True
|
| 224 |
-
logger.info("์๋ต๏ฟฝ๏ฟฝ๏ฟฝ์ ์ด๋ฏธ์ง ์ถ์ถ ์ฑ๊ณต")
|
| 225 |
-
if not image_found:
|
| 226 |
-
return None, f"API์์ ์ด๋ฏธ์ง๋ฅผ ์์ฑํ์ง ๋ชปํ์ต๋๋ค. ์๋ต ํ
์คํธ: {result_text}"
|
| 227 |
-
result_img = Image.open(temp_path)
|
| 228 |
-
if result_img.mode == "RGBA":
|
| 229 |
-
result_img = result_img.convert("RGB")
|
| 230 |
-
return result_img, f"์ด๋ฏธ์ง๊ฐ ์ฑ๊ณต์ ์ผ๋ก ์์ฑ๋์์ต๋๋ค. {result_text}"
|
| 231 |
-
except Exception as e:
|
| 232 |
-
logger.exception("์ด๋ฏธ์ง ์์ฑ ์ค ์ค๋ฅ ๋ฐ์:")
|
| 233 |
-
return None, f"์ค๋ฅ ๋ฐ์: {str(e)}"
|
| 234 |
-
|
| 235 |
-
def process_images_with_prompt(image1, image2, image3, prompt, variation_index=0, max_retries=3):
|
| 236 |
-
"""
|
| 237 |
-
3๊ฐ์ ์ด๋ฏธ์ง์ ํ๋กฌํํธ๋ฅผ ์ฒ๋ฆฌํ์ฌ ์ต์ข
์์ด ํ๋กฌํํธ(final_prompt)๋ฅผ ์์ฑํ ํ,
|
| 238 |
-
API๋ฅผ ํธ์ถํ์ฌ ๊ฒฐ๊ณผ ์ด๋ฏธ์ง๋ฅผ ๋ฐํํฉ๋๋ค. ์๋ฌ ๋ฐ์ ์ ์ต๋ max_retries ํ์๋งํผ ์ฌ์๋ํฉ๋๋ค.
|
| 239 |
-
"""
|
| 240 |
-
retry_count = 0
|
| 241 |
-
last_error = None
|
| 242 |
-
|
| 243 |
-
while retry_count < max_retries:
|
| 244 |
-
try:
|
| 245 |
-
images = [image1, image2, image3]
|
| 246 |
-
valid_images = [img for img in images if img is not None]
|
| 247 |
-
if not valid_images:
|
| 248 |
-
return None, "์ ์ด๋ ํ๋์ ์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํด์ฃผ์ธ์.", ""
|
| 249 |
-
|
| 250 |
-
if prompt and prompt.strip():
|
| 251 |
-
processed_prompt = preprocess_prompt(prompt, image1, image2, image3)
|
| 252 |
-
if re.search("[๊ฐ-ํฃ]", processed_prompt):
|
| 253 |
-
final_prompt = translate_prompt_to_english(processed_prompt)
|
| 254 |
-
else:
|
| 255 |
-
final_prompt = processed_prompt
|
| 256 |
-
else:
|
| 257 |
-
if len(valid_images) == 1:
|
| 258 |
-
final_prompt = "Please creatively transform this image into a more vivid and artistic version. Do not include any text or watermarks in the generated image."
|
| 259 |
-
logger.info("Default prompt generated for single image")
|
| 260 |
-
elif len(valid_images) == 2:
|
| 261 |
-
final_prompt = "Please seamlessly composite these two images, integrating their key elements harmoniously into a single image. Do not include any text or watermarks in the generated image."
|
| 262 |
-
logger.info("Default prompt generated for two images")
|
| 263 |
-
else:
|
| 264 |
-
final_prompt = "Please creatively composite these three images, combining their main elements into a cohesive and natural scene. Do not include any text or watermarks in the generated image."
|
| 265 |
-
logger.info("Default prompt generated for three images")
|
| 266 |
-
|
| 267 |
-
result_img, status = generate_with_images(final_prompt, valid_images, variation_index)
|
| 268 |
-
if result_img is not None:
|
| 269 |
-
return result_img, status, final_prompt
|
| 270 |
-
else:
|
| 271 |
-
last_error = status
|
| 272 |
-
retry_count += 1
|
| 273 |
-
logger.warning(f"์ด๋ฏธ์ง ์์ฑ ์คํจ, ์ฌ์๋ {retry_count}/{max_retries}: {status}")
|
| 274 |
-
time.sleep(1)
|
| 275 |
-
except Exception as e:
|
| 276 |
-
last_error = str(e)
|
| 277 |
-
retry_count += 1
|
| 278 |
-
logger.exception(f"์ด๋ฏธ์ง ์ฒ๋ฆฌ ์ค ์ค๋ฅ ๋ฐ์, ์ฌ์๋ {retry_count}/{max_retries}:")
|
| 279 |
-
time.sleep(1)
|
| 280 |
-
|
| 281 |
-
return None, f"์ต๋ ์ฌ์๋ ํ์({max_retries}ํ) ์ด๊ณผ ํ ์คํจ: {last_error}", prompt
|
| 282 |
-
|
| 283 |
-
def generate_multiple_images(image1, image2, image3, prompt, progress=gr.Progress()):
|
| 284 |
-
"""
|
| 285 |
-
์ฌ๋ฌ ๊ฐ์ ์ด๋ฏธ์ง๋ฅผ ์ฐจ๋ก๋๋ก ์์ฑํฉ๋๋ค.
|
| 286 |
-
"""
|
| 287 |
-
results = []
|
| 288 |
-
statuses = []
|
| 289 |
-
prompts = []
|
| 290 |
-
|
| 291 |
-
num_images = 4 # ์์ฑํ ์ด๋ฏธ์ง ์
|
| 292 |
-
max_retries = 3 # ๊ฐ ์ด๋ฏธ์ง ๋น ์ต๋ ์ฌ์๋ ํ์
|
| 293 |
-
|
| 294 |
-
progress(0, desc="์ด๋ฏธ์ง ์์ฑ ์ค๋น ์ค...")
|
| 295 |
-
|
| 296 |
-
for i in range(num_images):
|
| 297 |
-
progress((i / num_images), desc=f"{i+1}/{num_images} ์ด๋ฏธ์ง ์์ฑ ์ค...")
|
| 298 |
-
result_img, status, final_prompt = process_images_with_prompt(image1, image2, image3, prompt, i, max_retries)
|
| 299 |
-
|
| 300 |
-
if result_img is not None:
|
| 301 |
-
results.append(result_img)
|
| 302 |
-
statuses.append(f"์ด๋ฏธ์ง #{i+1}: {status}")
|
| 303 |
-
prompts.append(f"์ด๋ฏธ์ง #{i+1}: {final_prompt}")
|
| 304 |
-
else:
|
| 305 |
-
results.append(None)
|
| 306 |
-
statuses.append(f"์ด๋ฏธ์ง #{i+1} ์์ฑ ์คํจ: {status}")
|
| 307 |
-
prompts.append(f"์ด๋ฏธ์ง #{i+1}: {final_prompt}")
|
| 308 |
-
|
| 309 |
-
time.sleep(1)
|
| 310 |
-
|
| 311 |
-
progress(1.0, desc="์ด๋ฏธ์ง ์์ฑ ์๋ฃ!")
|
| 312 |
-
|
| 313 |
-
while len(results) < 4:
|
| 314 |
-
results.append(None)
|
| 315 |
-
|
| 316 |
-
combined_status = "\n".join(statuses)
|
| 317 |
-
combined_prompts = "\n".join(prompts)
|
| 318 |
-
|
| 319 |
-
return results[0], results[1], results[2], results[3], combined_status, combined_prompts
|
| 320 |
-
|
| 321 |
-
# ์ด๋ฏธ์ง ์
์ค์ผ์ผ ํจ์
|
| 322 |
-
def upscale_image(img):
|
| 323 |
-
try:
|
| 324 |
-
# ๋ชจ๋ธ ์ด๊ธฐํ
|
| 325 |
-
model = SRVGGNetCompact(num_in_ch=3, num_out_ch=3, num_feat=64, num_conv=32, upscale=4, act_type='prelu')
|
| 326 |
-
model_path = 'realesr-general-x4v3.pth'
|
| 327 |
-
half = True if torch.cuda.is_available() else False
|
| 328 |
-
upsampler = RealESRGANer(scale=4, model_path=model_path, model=model, tile=0, tile_pad=10, pre_pad=0, half=half)
|
| 329 |
-
|
| 330 |
-
# ์ด๋ฏธ์ง ํ์ผ ์ฝ๊ธฐ
|
| 331 |
-
img = cv2.imread(img, cv2.IMREAD_UNCHANGED)
|
| 332 |
-
if len(img.shape) == 3 and img.shape[2] == 4:
|
| 333 |
-
img_mode = 'RGBA'
|
| 334 |
-
elif len(img.shape) == 2:
|
| 335 |
-
img_mode = None
|
| 336 |
-
img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
|
| 337 |
-
else:
|
| 338 |
-
img_mode = None
|
| 339 |
-
|
| 340 |
-
# ์์ ์ด๋ฏธ์ง ํฌ๊ธฐ ์กฐ์
|
| 341 |
-
h, w = img.shape[0:2]
|
| 342 |
-
if h < 300:
|
| 343 |
-
img = cv2.resize(img, (w * 2, h * 2), interpolation=cv2.INTER_LANCZOS4)
|
| 344 |
-
|
| 345 |
-
# GFPGANv1.4 ๋ชจ๋ธ ์ฌ์ฉ
|
| 346 |
-
face_enhancer = GFPGANer(
|
| 347 |
-
model_path='GFPGANv1.4.pth',
|
| 348 |
-
upscale=2,
|
| 349 |
-
arch='clean',
|
| 350 |
-
channel_multiplier=2,
|
| 351 |
-
bg_upsampler=upsampler
|
| 352 |
-
)
|
| 353 |
-
|
| 354 |
-
# ์ด๋ฏธ์ง ํฅ์
|
| 355 |
-
try:
|
| 356 |
-
_, _, output = face_enhancer.enhance(img, has_aligned=False, only_center_face=False, paste_back=True)
|
| 357 |
-
except RuntimeError as error:
|
| 358 |
-
print('์ค๋ฅ', error)
|
| 359 |
-
return None
|
| 360 |
-
|
| 361 |
-
# RGB๋ก ๋ณํํ์ฌ ๋ฐํ
|
| 362 |
-
output = cv2.cvtColor(output, cv2.COLOR_BGR2RGB)
|
| 363 |
-
return output
|
| 364 |
-
except Exception as error:
|
| 365 |
-
print('๊ธ๋ก๋ฒ ์์ธ', error)
|
| 366 |
-
return None
|
| 367 |
-
|
| 368 |
-
# ์์ ์ ์
์ค์ผ์ผ๋ฌ ๋ชจ๋ธ ๋ค์ด๋ก๋
|
| 369 |
-
download_upscaler_models()
|
| 370 |
-
|
| 371 |
-
# Gradio ์ธํฐํ์ด์ค
|
| 372 |
-
with gr.Blocks() as demo:
|
| 373 |
-
gr.HTML(
|
| 374 |
-
"""
|
| 375 |
-
<div style="text-align: center; margin-bottom: 1rem;">
|
| 376 |
-
<h1>์ด์ปค๋จธ์ค์ฉ ์ด๋ฏธ์ง ์์ฑ ๋ฐ ํธ์ง ๋๊ตฌ</h1>
|
| 377 |
-
<p>์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํ๊ณ ์์ ๋ฅผ ์ฐธ๊ณ ํ์ฌ ํ๋กฌํํธ๋ฅผ ์์ ํ๊ฑฐ๋ ์ด๋ฏธ์ง ์
์ค์ผ์ผ ๊ธฐ๋ฅ์ ์ด์ฉํ์ธ์.</p>
|
| 378 |
-
</div>
|
| 379 |
-
"""
|
| 380 |
-
)
|
| 381 |
-
|
| 382 |
-
with gr.Tabs() as tabs:
|
| 383 |
-
# ์ฒซ ๋ฒ์งธ ํญ: ์ด๋ฏธ์ง ์์ฑ๊ธฐ
|
| 384 |
-
with gr.Tab("์ด๋ฏธ์ง ์์ฑ๊ธฐ"):
|
| 385 |
-
with gr.Row():
|
| 386 |
-
# ์ผ์ชฝ ์
๋ ฅ ์์ญ (์์ ์ด๋ฏธ์ง๋ฅผ ํฌํจํ์ฌ ์ฌ์ฉ ๋ฐฉ๋ฒ ์๋์ ๋ฐฐ์น)
|
| 387 |
-
with gr.Column(scale=1):
|
| 388 |
-
with gr.Row():
|
| 389 |
-
image1_input = gr.Image(type="pil", label="#1", image_mode="RGB", height=300, width=200)
|
| 390 |
-
image2_input = gr.Image(type="pil", label="#2", image_mode="RGB", height=300, width=200)
|
| 391 |
-
image3_input = gr.Image(type="pil", label="#3", image_mode="RGB", height=300, width=200)
|
| 392 |
-
prompt_input = gr.Textbox(
|
| 393 |
-
lines=3,
|
| 394 |
-
placeholder="ํ๋กฌํํธ๋ฅผ ์
๋ ฅํ๊ฑฐ๋ ๋น์๋๋ฉด ์๋ ํฉ์ฑ๋ฉ๋๋ค.",
|
| 395 |
-
label="ํ๋กฌํํธ (์ ํ ์ฌํญ)"
|
| 396 |
-
)
|
| 397 |
-
with gr.Row():
|
| 398 |
-
image_change_btn1 = gr.Button("์ด๋ฏธ์ง ๋ณ๊ฒฝ-1")
|
| 399 |
-
image_change_btn2 = gr.Button("์ด๋ฏธ์ง ๋ณ๊ฒฝ-2")
|
| 400 |
-
text_remove_btn = gr.Button("๊ธ์ ์ง์ฐ๊ธฐ")
|
| 401 |
-
text_change_btn = gr.Button("๊ธ์ ๋ณ๊ฒฝํ๊ธฐ")
|
| 402 |
-
clothes_change_btn1 = gr.Button("๊ฐ์ ์ํ์ฐฉ์ฉ-1")
|
| 403 |
-
clothes_change_btn2 = gr.Button("๊ฐ์ ์ํ์ฐฉ์ฉ-2")
|
| 404 |
-
holding_product_btn = gr.Button("์ํ๋ค๊ณ ์๊ธฐ")
|
| 405 |
-
background_change_btn = gr.Button("๋ฐฐ๊ฒฝ ๋ฐ๊พธ๊ธฐ")
|
| 406 |
-
composite_product_btn = gr.Button("๋ถ๋ถ ์ง์ฐ๊ธฐ")
|
| 407 |
-
submit_btn = gr.Button("์ด๋ฏธ์ง ์์ฑ (4์ฅ)", variant="primary")
|
| 408 |
-
|
| 409 |
-
gr.Markdown(
|
| 410 |
-
"""
|
| 411 |
-
### ์ฌ์ฉ ๋ฐฉ๋ฒ:
|
| 412 |
-
|
| 413 |
-
1. **์๋ ํฉ์ฑ**: ์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํ๊ณ ํ๋กฌํํธ๋ฅผ ๋น์๋๋ฉด ์๋์ผ๋ก ํฉ์ฑ๋ฉ๋๋ค.
|
| 414 |
-
2. **์ด๋ฏธ์ง ์ฐธ์กฐ**: #1, #2, #3์ผ๋ก ๊ฐ ์ด๋ฏธ์ง๋ฅผ ์ฐธ์กฐํ ์ ์์ต๋๋ค.
|
| 415 |
-
3. **์ ํ ์ต์
**: ์์ ๋ฒํผ์ ํด๋ฆญํ๋ฉด ํ๋กฌํํธ ์
๋ ฅ๋์ ํ๊ตญ์ด ๋ฌธ๊ตฌ๋ก ์
๋ ฅํ์๋ฉด ๋ฉ๋๋ค.
|
| 416 |
-
4. **๋ค์ํ ์ด๋ฏธ์ง**: "์ด๋ฏธ์ง ์์ฑ" ๋ฒํผ์ ํด๋ฆญํ๋ฉด ์ฐจ๋ก๋ก 4์ฅ์ ์ด๋ฏธ์ง๊ฐ ์์ฑ๋ฉ๋๋ค.
|
| 417 |
-
5. **์์ ์ ํ**: ๋ค์ํ ์์ ๋ฅผ ํตํด ๋ฏธ๋ฆฌ ํ
์คํธํด๋ณด์ธ์.
|
| 418 |
-
|
| 419 |
-
> **ํ**: ํ๋กฌํํธ๋ฅผ ์ง์ ์์ ํ ์๋ ์์ต๋๋ค.
|
| 420 |
-
"""
|
| 421 |
-
)
|
| 422 |
-
|
| 423 |
-
# ์์ ์ด๋ฏธ์ง: ์ฌ์ฉ ๋ฐฉ๋ฒ ์๋ ์ผ์ชฝ ์์ญ์ ๋ฐฐ์น
|
| 424 |
-
gr.Markdown("## ์์ ์ด๋ฏธ์ง")
|
| 425 |
-
examples = [
|
| 426 |
-
["down/๋ชจ๋ธ.jpg", None, None, "(#1์ ์ฌ์ฑ)์ด ์ด์ง ๋ค๋ก ๋์๋ณด๋ ๋ชจ์ต์ผ๋ก ์ต๋ํ ์ด์ seed๋ฅผ ์ ์งํํ
์์ฐ์ค๋ฝ๊ฒ ๋ณ๊ฒฝํ๋ผ."],
|
| 427 |
-
["down/์์ด๋ ๊ณ ๋ชจํ.png", None, None, "(#1 ๋ ๋ชจ๋ชจํ)์์ ์ฒญ์์์ด๋ ๊ณ ๋ง ๊ฒ์์ ๊ณ ๋๋ ๊ณ ๋ก ๏ฟฝ๏ฟฝ๏ฟฝ๊ฒฝํ๊ณ ๋๋จธ์ง ๋ถ๋ถ์ seed๋ฅผ ๋ณ๊ฒฝ์ ํ์ง๋ง๋ผ."],
|
| 428 |
-
["down/์ค๊ตญ์ด.png", None, None, "(#1 ์ด๋ฏธ์ง)์ ์๋ ์ค๊ตญ์ด๋ฅผ ๋ชจ๋ ์ ๊ฑฐํ๋ผ."],
|
| 429 |
-
["down/ํ
์คํธ.webp", None, None, '(#1์ ํ
์คํธ)๋ฅผ ์คํ์ผ์ ์ ์งํ์ฒด ํ
์คํธ๋ง "Hello"๋ก ๋ฐ๊ฟ๋ผ'],
|
| 430 |
-
["down/๋ชจ๋ธ.jpg", "down/์ ๊ธ๋ผ์ค.png", "down/์ฒญ๋ฐ์ง.png", "(#1์ ์ฌ์ฑ๋ชจ๋ธ)์ด ์ ์ฒด ๋น์จ๊ณผ ํฌ์ฆ๋ ์ ์นํ ์ฒด (#2์ ์ ๊ธ๋ผ์ค)์ (#3์ ์ฒญ๋ฐ์ง)๋ฅผ ์ง์ ๋ชจ๋ธ์ด ์ฐฉ์ฉํ๊ฒ ์ฒ๋ผ ์์ฐ์ค๋ฝ๊ฒ ์ด๋ฏธ์ง๋ฅผ ์์ฑํ๋ผ."],
|
| 431 |
-
["down/๋ชจ๋ธ.jpg", "down/์ ๊ธ๋ผ์ค.png", "down/์นดํ์ ๊ฒฝ.png", "(#1์ ์ฌ์ฑ๋ชจ๋ธ)์ด ์ ์ฒด ๋น์จ๊ณผ ํฌ์ฆ๋ ์ ์นํ ์ฒด (#2์ ์ ๊ธ๋ผ์ค)๋ฅผ ์ง์ ๋ชจ๋ธ์ด ์ฐฉ์ฉํ ๊ฒ์ฒ๋ผ (#3์ ์ฅ์)์์ ์์์ ์์ ์๋ ์์ฐ์ค๋ฌ์ด ์ด๋ฏธ์ง๋ฅผ ์์ฑํ๋ผ."],
|
| 432 |
-
["down/๋ชจ๋ธ.jpg", "down/์์ธ์.png", None, "(#1์ ์ฌ์ฑ๋ชจ๋ธ)์ด ์ ์ฒด ๋น์จ๊ณผ ํฌ์ฆ๋ ์ ์นํ ์ฒด (#2์ ์์ธ์)์ ์ฌ์ฑ๋ชจ๋ธ์ด ํ๋ณดํ ์์ธ์์ ๋๋ณด์ด๊ฒ ๋ค๊ณ ์๋ ์์ฐ์ค๋ฌ์ด ๋ชจ์ต์ผ๋ก ์ด๋ฏธ์ง๋ฅผ ์์ฑํ๋ผ."],
|
| 433 |
-
["down/๋ชจ๋ธ.jpg", "down/์นดํ์ ๊ฒฝ.png", None, "(#1์ ์ฌ์ฑ๋ชจ๋ธ)์ด (#2 ์ด๋ฏธ์ง์ ๋ฐฐ๊ฒฝ)์ ์ฃผ์ ํผ์ฌ์ฒด๋ ๊ทธ๋๋ก ์ ์งํ์ฌ ์ด๋ฏธ์ง์ ๋ถ์๊ธฐ๊ฐ ์์ฐ์ค๋ฝ๊ฒ ์ด์ฐ๋ฌ์ง๋๋ก ์์ฑํ๋ผ."],
|
| 434 |
-
["down/์์ด๋ ๊ณ ๋ชจํ.png", None, None, "(#1์ ๋ ๊ณ ๋ชจํ)์์ ์ฒญ์์์ด๋ ๊ณ ๋ฅผ ์ ๊ฑฐํ ํ, ๊ทธ ์๋ฆฌ๋ฅผ ์ฃผ๋ณ ๋ฐฐ๊ฒฝ๊ณผ ์์ฐ์ค๋ฝ๊ฒ ์ด์ฐ๋ฌ์ง๋๋ก ์ฑ์์ฃผ์ธ์. ๋จ, ์ด๋ฏธ์ง์ ๋ค๋ฅธ ๋ถ๋ถ์ ์ฃผ์ ์์๋ ๋์ผํ๊ฒ ์ ์งํด ํด์ผํ๋ค."]
|
| 435 |
-
]
|
| 436 |
-
|
| 437 |
-
gr.Examples(
|
| 438 |
-
examples=examples,
|
| 439 |
-
inputs=[image1_input, image2_input, image3_input, prompt_input]
|
| 440 |
-
)
|
| 441 |
-
|
| 442 |
-
# ์ค๋ฅธ์ชฝ ์ถ๋ ฅ ์์ญ
|
| 443 |
-
with gr.Column(scale=1):
|
| 444 |
-
with gr.Row():
|
| 445 |
-
with gr.Column():
|
| 446 |
-
output_image1 = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง #1", height=600, width=450)
|
| 447 |
-
output_image3 = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง #3", height=600, width=450)
|
| 448 |
-
with gr.Column():
|
| 449 |
-
output_image2 = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง #2", height=600, width=450)
|
| 450 |
-
output_image4 = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง #4", height=600, width=450)
|
| 451 |
-
|
| 452 |
-
output_text = gr.Textbox(label="์ํ ๋ฉ์์ง", lines=4)
|
| 453 |
-
prompt_display = gr.Textbox(label="์ฌ์ฉ๋ ํ๋กฌํํธ (์์ด)", visible=True, lines=4)
|
| 454 |
-
|
| 455 |
-
# ์ ํ ์ต์
๋ฒํผ ํด๋ฆญ ์ ํ๋กฌํํธ ์
๋ ฅ๋ ์
๋ฐ์ดํธ (ํ๊ตญ์ด ๋ฌธ๊ตฌ)
|
| 456 |
-
image_change_btn1.click(
|
| 457 |
-
fn=lambda: "(#1์ ์ฌ์ฑ)์ด ์ด์ง ๋ค๋ก ๋์๋ณด๋ ๋ชจ์ต์ผ๋ก ์ต๋ํ ์ด์ seed๋ฅผ ์ ์งํํ
์์ฐ์ค๋ฝ๊ฒ ๋ณ๊ฒฝํ๋ผ.",
|
| 458 |
-
inputs=[],
|
| 459 |
-
outputs=prompt_input
|
| 460 |
-
)
|
| 461 |
-
image_change_btn2.click(
|
| 462 |
-
fn=lambda: "(#1 ๋ ๋ชจ๋ชจํ)์์ ์ฒญ์์์ด๋ ๊ณ ๋ง ๊ฒ์์ ๊ณ ๋๋ ๊ณ ๋ก ๋ณ๊ฒฝํ๊ณ ๋๋จธ์ง ๋ถ๋ถ์ seed๋ฅผ ๋ณ๊ฒฝ์ ํ์ง๋ง๋ผ.",
|
| 463 |
-
inputs=[],
|
| 464 |
-
outputs=prompt_input
|
| 465 |
-
)
|
| 466 |
-
text_remove_btn.click(
|
| 467 |
-
fn=lambda: "(#1 ์ด๋ฏธ์ง)์ ์๋ ์ค๊ตญ์ด๋ฅผ ๋ชจ๋ ์ ๊ฑฐํ๋ผ.",
|
| 468 |
-
inputs=[],
|
| 469 |
-
outputs=prompt_input
|
| 470 |
-
)
|
| 471 |
-
text_change_btn.click(
|
| 472 |
-
fn=lambda: "(#1์ ํ
์คํธ)๋ฅผ ์คํ์ผ์ ์ ์งํ์ฒด ํ
์คํธ๋ง \"Hello\"๋ก ๋ฐ๊ฟ๋ผ",
|
| 473 |
-
inputs=[],
|
| 474 |
-
outputs=prompt_input
|
| 475 |
-
)
|
| 476 |
-
clothes_change_btn1.click(
|
| 477 |
-
fn=lambda: "(#1์ ์ฌ์ฑ๋ชจ๋ธ)์ด ์ ์ฒด ๋น์จ๊ณผ ํฌ์ฆ๋ ์ ์นํ ์ฒด (#2์ ์ ๊ธ๋ผ์ค)์ (#3์ ์ฒญ๋ฐ์ง)๋ฅผ ์ง์ ๋ชจ๋ธ์ด ์ฐฉ์ฉํ๊ฒ ์ฒ๋ผ ์์ฐ์ค๋ฝ๊ฒ ์ด๋ฏธ์ง๋ฅผ ์์ฑํ๋ผ.",
|
| 478 |
-
inputs=[],
|
| 479 |
-
outputs=prompt_input
|
| 480 |
-
)
|
| 481 |
-
clothes_change_btn2.click(
|
| 482 |
-
fn=lambda: "(#1์ ์ฌ์ฑ๋ชจ๋ธ)์ด ์ ์ฒด ๋น์จ๊ณผ ํฌ์ฆ๋ ์ ์นํ ์ฒด (#2์ ์ ๊ธ๋ผ์ค)๋ฅผ ์ง์ ๋ชจ๋ธ์ด ์ฐฉ์ฉํ ๊ฒ์ฒ๋ผ (#3์ ์ฅ์)์์ ์์์ ์์ ์๋ ์์ฐ์ค๋ฌ์ด ์ด๋ฏธ์ง๋ฅผ ์์ฑํ๋ผ.",
|
| 483 |
-
inputs=[],
|
| 484 |
-
outputs=prompt_input
|
| 485 |
-
)
|
| 486 |
-
holding_product_btn.click(
|
| 487 |
-
fn=lambda: "(#1์ ์ฌ์ฑ๋ชจ๋ธ)์ด ์ ์ฒด ๋น์จ๊ณผ ํฌ์ฆ๋ ์ ์นํ ์ฒด (#2์ ์์ธ์)์ ์ฌ์ฑ๋ชจ๋ธ์ด ํ๋ณดํ ์์ธ์์ ๋๋ณด์ด๊ฒ ๋ค๊ณ ์๋ ์์ฐ์ค๋ฌ์ด ๋ชจ์ต์ผ๋ก ์ด๋ฏธ์ง๋ฅผ ์์ฑํ๋ผ.",
|
| 488 |
-
inputs=[],
|
| 489 |
-
outputs=prompt_input
|
| 490 |
-
)
|
| 491 |
-
background_change_btn.click(
|
| 492 |
-
fn=lambda: "(#1์ ์ฌ์ฑ๋ชจ๋ธ)์ด (#2 ์ด๋ฏธ์ง์ ๋ฐฐ๊ฒฝ)์ ์ฃผ์ ํผ์ฌ์ฒด๋ ๊ทธ๋๋ก ์ ์งํ์ฌ ๋ ์ด๋ฏธ์ง์ ๋ถ์๊ธฐ๊ฐ ์์ฐ์ค๋ฝ๊ฒ ์ด์ฐ๋ฌ์ง๋๋ก ์์ฑํ๋ผ.",
|
| 493 |
-
inputs=[],
|
| 494 |
-
outputs=prompt_input
|
| 495 |
-
)
|
| 496 |
-
composite_product_btn.click(
|
| 497 |
-
fn=lambda: "(#1์ ๋ ๊ณ ๋ชจํ)์์ ์ฒญ์์์ด๋ ๊ณ ๋ฅผ ์ ๊ฑฐํ ํ, ๊ทธ ์๋ฆฌ๋ฅผ ์ฃผ๋ณ ๋ฐฐ๊ฒฝ๊ณผ ์์ฐ์ค๋ฝ๊ฒ ์ด์ฐ๋ฌ์ง๋๋ก ์ฑ์์ฃผ์ธ์. ๋จ, ์ด๋ฏธ์ง์ ๋ค๋ฅธ ๋ถ๋ถ์ ์ฃผ์ ์์๋ ๋์ผํ๊ฒ ์ ์งํด ํด์ผํ๋ค.",
|
| 498 |
-
inputs=[],
|
| 499 |
-
outputs=prompt_input
|
| 500 |
-
)
|
| 501 |
-
|
| 502 |
-
submit_btn.click(
|
| 503 |
-
fn=generate_multiple_images,
|
| 504 |
-
inputs=[image1_input, image2_input, image3_input, prompt_input],
|
| 505 |
-
outputs=[output_image1, output_image2, output_image3, output_image4, output_text, prompt_display],
|
| 506 |
-
)
|
| 507 |
-
|
| 508 |
-
# ๋ ๋ฒ์งธ ํญ: ์ด๋ฏธ์ง ์
์ค์ผ์ผ๋ฌ
|
| 509 |
-
with gr.Tab("์ด๋ฏธ์ง ์
์ค์ผ์ผ๋ฌ"):
|
| 510 |
-
gr.Markdown(
|
| 511 |
-
"""
|
| 512 |
-
# ์ด๋ฏธ์ง ์
์ค์ผ์ผ๋ฌ
|
| 513 |
-
|
| 514 |
-
์
๋ก๋ํ ์ด๋ฏธ์ง๋ฅผ ๊ณ ํด์๋๋ก ๋ณํํฉ๋๋ค. ํนํ ์ธ๋ฌผ ์ฌ์ง์ ์ผ๊ตด ๋ํ
์ผ์ ํฅ์์ํต๋๋ค.
|
| 515 |
-
"""
|
| 516 |
-
)
|
| 517 |
-
|
| 518 |
-
with gr.Row():
|
| 519 |
-
with gr.Column():
|
| 520 |
-
input_upscale_image = gr.Image(type="filepath", label="์
๋ ฅ ์ด๋ฏธ์ง")
|
| 521 |
-
upscale_btn = gr.Button("์ด๋ฏธ์ง ์
์ค์ผ์ผ", variant="primary")
|
| 522 |
-
|
| 523 |
-
with gr.Column():
|
| 524 |
-
output_upscale_image = gr.Image(type="numpy", label="๊ฒฐ๊ณผ ์ด๋ฏธ์ง")
|
| 525 |
-
|
| 526 |
-
upscale_btn.click(
|
| 527 |
-
fn=upscale_image,
|
| 528 |
-
inputs=[input_upscale_image],
|
| 529 |
-
outputs=[output_upscale_image]
|
| 530 |
-
)
|
| 531 |
-
|
| 532 |
-
if __name__ == "__main__":
|
| 533 |
-
demo.launch(share=True)
|
|
|
|
| 1 |
+
google-genai==1.5.0
|
| 2 |
+
google-generativeai==0.3.1
|
| 3 |
+
gradio==5.21.0
|
| 4 |
+
pydantic==2.10.6
|
| 5 |
+
pillow==10.2.0
|
| 6 |
+
python-dotenv
|
| 7 |
+
absl-py==2.1.0
|
| 8 |
+
addict==2.4.0
|
| 9 |
+
aiofiles==23.2.1
|
| 10 |
+
altair==5.3.0
|
| 11 |
+
annotated-types==0.6.0
|
| 12 |
+
anyio>=4.8.0
|
| 13 |
+
attrs==23.2.0
|
| 14 |
+
basicsr==1.4.2
|
| 15 |
+
certifi==2024.2.2
|
| 16 |
+
charset-normalizer==3.3.2
|
| 17 |
+
click==8.1.7
|
| 18 |
+
contourpy==1.2.1
|
| 19 |
+
cycler==0.12.1
|
| 20 |
+
facexlib==0.3.0
|
| 21 |
+
fastapi==0.110.2
|
| 22 |
+
ffmpy==0.3.2
|
| 23 |
+
filelock==3.13.4
|
| 24 |
+
filterpy==1.4.5
|
| 25 |
+
fonttools==4.51.0
|
| 26 |
+
fsspec==2024.3.1
|
| 27 |
+
future==1.0.0
|
| 28 |
+
gfpgan==1.3.8
|
| 29 |
+
grpcio==1.62.2
|
| 30 |
+
h11==0.14.0
|
| 31 |
+
httpcore>=1.0.0
|
| 32 |
+
httpx>=0.28.1 # ๋ฒ์ ์
๋ฐ์ดํธ
|
| 33 |
+
huggingface-hub==0.22.2
|
| 34 |
+
idna==3.7
|
| 35 |
+
imageio==2.34.1
|
| 36 |
+
importlib_metadata==7.1.0
|
| 37 |
+
importlib_resources==6.4.0
|
| 38 |
+
Jinja2==3.1.3
|
| 39 |
+
jsonschema==4.21.1
|
| 40 |
+
jsonschema-specifications==2023.12.1
|
| 41 |
+
kiwisolver==1.4.5
|
| 42 |
+
lazy_loader==0.4
|
| 43 |
+
llvmlite==0.42.0
|
| 44 |
+
lmdb==1.4.1
|
| 45 |
+
Markdown==3.6
|
| 46 |
+
markdown-it-py==3.0.0
|
| 47 |
+
MarkupSafe==2.1.5
|
| 48 |
+
matplotlib==3.8.4
|
| 49 |
+
mdurl==0.1.2
|
| 50 |
+
mpmath==1.3.0
|
| 51 |
+
networkx==3.3
|
| 52 |
+
numba==0.59.1
|
| 53 |
+
numpy==1.26.4
|
| 54 |
+
opencv-python==4.9.0.80
|
| 55 |
+
orjson==3.10.1
|
| 56 |
+
packaging==24.0
|
| 57 |
+
pandas==2.2.2
|
| 58 |
+
platformdirs==4.2.1
|
| 59 |
+
protobuf<4
|
| 60 |
+
pydub==0.25.1
|
| 61 |
+
Pygments==2.17.2
|
| 62 |
+
pyparsing==3.1.2
|
| 63 |
+
python-dateutil==2.9.0.post0
|
| 64 |
+
python-multipart==0.0.9
|
| 65 |
+
pytz==2024.1
|
| 66 |
+
PyYAML==6.0.1
|
| 67 |
+
realesrgan==0.3.0
|
| 68 |
+
referencing==0.35.0
|
| 69 |
+
requests==2.31.0
|
| 70 |
+
rich==13.7.1
|
| 71 |
+
rpds-py==0.18.0
|
| 72 |
+
ruff==0.4.2
|
| 73 |
+
scikit-image==0.23.2
|
| 74 |
+
scipy==1.13.0
|
| 75 |
+
semantic-version==2.10.0
|
| 76 |
+
shellingham==1.5.4
|
| 77 |
+
six==1.16.0
|
| 78 |
+
sniffio==1.3.1
|
| 79 |
+
starlette==0.37.2
|
| 80 |
+
sympy==1.12
|
| 81 |
+
tb-nightly==2.17.0a20240428
|
| 82 |
+
tensorboard-data-server==0.7.2
|
| 83 |
+
tifffile==2024.4.24
|
| 84 |
+
tomli==2.0.1
|
| 85 |
+
tomlkit==0.12.0
|
| 86 |
+
toolz==0.12.1
|
| 87 |
+
torch==2.3.0
|
| 88 |
+
torchvision==0.18.0
|
| 89 |
+
tqdm==4.66.2
|
| 90 |
+
typer==0.12.3
|
| 91 |
+
typing_extensions==4.11.0
|
| 92 |
+
tzdata==2024.1
|
| 93 |
+
urllib3==2.2.1
|
| 94 |
+
uvicorn==0.29.0
|
| 95 |
+
websockets==11.0.3
|
| 96 |
+
Werkzeug==3.0.2
|
| 97 |
+
yapf==0.40.2
|
| 98 |
+
zipp==3.18.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|