Update app.py
Browse files
app.py
CHANGED
@@ -206,35 +206,6 @@ def process_and_show_prompt(image1, image2, image3, prompt):
|
|
206 |
logger.exception("์ฒ๋ฆฌ ์ค ์ค๋ฅ ๋ฐ์:")
|
207 |
return None, f"์ค๋ฅ ๋ฐ์: {str(e)}", prompt
|
208 |
|
209 |
-
# ์์ ์คํ ํจ์๋ค
|
210 |
-
def run_example_1():
|
211 |
-
"""์์ 1: ์ด๋ฏธ์ง ๋ณ๊ฒฝ ์์ """
|
212 |
-
input_path = os.path.join("down", "1_in-1.png")
|
213 |
-
output_path = os.path.join("down", "1_out-1.webp")
|
214 |
-
try:
|
215 |
-
input_img = Image.open(input_path)
|
216 |
-
except Exception as e:
|
217 |
-
return None, f"์
๋ ฅ ์ด๋ฏธ์ง ์ด๊ธฐ ์ค๋ฅ: {str(e)}", ""
|
218 |
-
prompt = "#1 ์ด๋ฏธ์ง์ [์ฒญ์ ์์ด๋ ๊ณ ๋ฅผ ๊ฒ์ ๊ณ ๋๋ ๊ณ ]์ผ๋ก ๋ณ๊ฒฝํ๋ผ."
|
219 |
-
result_img, status, final_prompt = process_and_show_prompt(input_img, None, None, prompt)
|
220 |
-
if result_img is not None:
|
221 |
-
result_img.save(output_path, "WEBP")
|
222 |
-
return result_img, status, final_prompt
|
223 |
-
|
224 |
-
def run_example_2():
|
225 |
-
"""์์ 2: ๊ธ์์ง์ฐ๊ธฐ ์์ """
|
226 |
-
input_path = os.path.join("down", "2_in-1.png")
|
227 |
-
output_path = os.path.join("down", "2_out-1.webp")
|
228 |
-
try:
|
229 |
-
input_img = Image.open(input_path)
|
230 |
-
except Exception as e:
|
231 |
-
return None, f"์
๋ ฅ ์ด๋ฏธ์ง ์ด๊ธฐ ์ค๋ฅ: {str(e)}", ""
|
232 |
-
prompt = "#1 ์ด๋ฏธ์ง์ [์ค๊ตญ์ด๋ฅผ ๋ชจ๋]๋ฅผ ์ ๊ฑฐํ๋ผ."
|
233 |
-
result_img, status, final_prompt = process_and_show_prompt(input_img, None, None, prompt)
|
234 |
-
if result_img is not None:
|
235 |
-
result_img.save(output_path, "WEBP")
|
236 |
-
return result_img, status, final_prompt
|
237 |
-
|
238 |
# Gradio ์ธํฐํ์ด์ค
|
239 |
with gr.Blocks() as demo:
|
240 |
gr.HTML(
|
@@ -262,7 +233,7 @@ with gr.Blocks() as demo:
|
|
262 |
text_remove_btn = gr.Button("๊ธ์์ง์ฐ๊ธฐ")
|
263 |
clothes_change_btn = gr.Button("์ท๋ฐ๊พธ๊ธฐ")
|
264 |
background_change_btn = gr.Button("๋ฐฐ๊ฒฝ๋ฐ๊พธ๊ธฐ")
|
265 |
-
composite_product_btn = gr.Button("
|
266 |
submit_btn = gr.Button("์ด๋ฏธ์ง ์์ฑ", variant="primary")
|
267 |
with gr.Column():
|
268 |
output_image = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง")
|
@@ -291,7 +262,7 @@ with gr.Blocks() as demo:
|
|
291 |
outputs=prompt_input
|
292 |
)
|
293 |
composite_product_btn.click(
|
294 |
-
fn=lambda: "#1
|
295 |
inputs=[],
|
296 |
outputs=prompt_input
|
297 |
)
|
|
|
206 |
logger.exception("์ฒ๋ฆฌ ์ค ์ค๋ฅ ๋ฐ์:")
|
207 |
return None, f"์ค๋ฅ ๋ฐ์: {str(e)}", prompt
|
208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
# Gradio ์ธํฐํ์ด์ค
|
210 |
with gr.Blocks() as demo:
|
211 |
gr.HTML(
|
|
|
233 |
text_remove_btn = gr.Button("๊ธ์์ง์ฐ๊ธฐ")
|
234 |
clothes_change_btn = gr.Button("์ท๋ฐ๊พธ๊ธฐ")
|
235 |
background_change_btn = gr.Button("๋ฐฐ๊ฒฝ๋ฐ๊พธ๊ธฐ")
|
236 |
+
composite_product_btn = gr.Button("์ํ๋ชจ๋ธํผํ
")
|
237 |
submit_btn = gr.Button("์ด๋ฏธ์ง ์์ฑ", variant="primary")
|
238 |
with gr.Column():
|
239 |
output_image = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง")
|
|
|
262 |
outputs=prompt_input
|
263 |
)
|
264 |
composite_product_btn.click(
|
265 |
+
fn=lambda: "#1 ์ํ ์ด๋ฏธ์ง์ #2 ์ด๋ฏธ์ง ๋๋ #3 ์ด๋ฏธ์ง๋ฅผ [๋ชจ๋ ์ด๋ฏธ์ง์ ์ฃผ์ ์์๋ฅผ ํฌํจํ๊ณ , ํนํ ์ํ์ด ๋๋ณด์ด๋๋ก ์กฐํ๋กญ๊ฒ ํตํฉํ์ฌ]์์ฐ์ค๋ฝ๊ฒ ํฉ์ฑํ๋ผ."",
|
266 |
inputs=[],
|
267 |
outputs=prompt_input
|
268 |
)
|