Update app.py
Browse files
app.py
CHANGED
@@ -66,6 +66,19 @@ def convert_and_save(image, filter_type, intensity):
|
|
66 |
cv2.imwrite(output_path, filtered_image)
|
67 |
return filtered_image, output_path
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
iface = gr.Interface(
|
70 |
fn=convert_and_save,
|
71 |
inputs=[
|
@@ -76,9 +89,15 @@ iface = gr.Interface(
|
|
76 |
),
|
77 |
gr.Slider(minimum=1, maximum=100, value=50, label="ํํฐ ๊ฐ๋")
|
78 |
],
|
79 |
-
outputs=["image", "file"],
|
80 |
title="์ด๋ฏธ์ง ํํฐ ๋ฐ ํ๋ฐฑ ๋ณํ๊ธฐ",
|
81 |
-
description="์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํ๊ณ ํํฐ์ ๊ฐ๋๋ฅผ ์ ํํ๋ฉด, ๋ณํ๋ ์ด๋ฏธ์ง๋ฅผ JPG ํ์ผ๋ก ๋ค์ด๋ก๋ํ ์ ์์ต๋๋ค."
|
|
|
82 |
)
|
83 |
|
|
|
|
|
|
|
|
|
|
|
84 |
iface.launch()
|
|
|
66 |
cv2.imwrite(output_path, filtered_image)
|
67 |
return filtered_image, output_path
|
68 |
|
69 |
+
def get_filter_description(filter_type):
|
70 |
+
descriptions = {
|
71 |
+
"Grayscale": "์ด๋ฏธ์ง๋ฅผ ํ๋ฐฑ์ผ๋ก ๋ณํํฉ๋๋ค.",
|
72 |
+
"Soft Glow": "๋ถ๋๋ฌ์ด ๋น์ ์ถ๊ฐํ์ฌ ์ด๋ฏธ์ง๋ฅผ ์์ํ๊ฒ ๋ง๋ญ๋๋ค.",
|
73 |
+
"Portrait Enhancer": "ํผ๋ถ ํค์ ๊ท ์ผํ๊ฒ ํ๊ณ ์ ๋ช
๋๋ฅผ ์กฐ์ ํ์ฌ ์ธ๋ฌผ์ ๋์ฑ ๋๋ณด์ด๊ฒ ๋ง๋ญ๋๋ค.",
|
74 |
+
"Warm Tone": "๋ฐ๋ปํ ์์กฐ๋ฅผ ์ถ๊ฐํ์ฌ ์ด๋ฏธ์ง์ ์จ๊ธฐ๋ฅผ ๋ํฉ๋๋ค.",
|
75 |
+
"Cold Tone": "์ฐจ๊ฐ์ด ์์กฐ๋ฅผ ์ถ๊ฐํ์ฌ ์ด๋ฏธ์ง์ ์์ํจ์ ๋ํฉ๋๋ค.",
|
76 |
+
"High-Key": "๋ฐ๊ณ ํ์ฌํ ์ด๋ฏธ์ง๋ฅผ ๋ง๋ค์ด๋
๋๋ค.",
|
77 |
+
"Low-Key": "์ด๋์ด ํค์ ๊ฐ์กฐํ์ฌ ๋ถ์๊ธฐ ์๋ ์ด๋ฏธ์ง๋ฅผ ๋ง๋ญ๋๋ค.",
|
78 |
+
"Haze": "๋ถ๋๋ฝ๊ณ ํ๋ฆฟํ ํจ๊ณผ๋ฅผ ์ถ๊ฐํ์ฌ ๋ชฝํ์ ์ธ ์ด๋ฏธ์ง๋ฅผ ๋ง๋ญ๋๋ค."
|
79 |
+
}
|
80 |
+
return descriptions.get(filter_type, "")
|
81 |
+
|
82 |
iface = gr.Interface(
|
83 |
fn=convert_and_save,
|
84 |
inputs=[
|
|
|
89 |
),
|
90 |
gr.Slider(minimum=1, maximum=100, value=50, label="ํํฐ ๊ฐ๋")
|
91 |
],
|
92 |
+
outputs=["image", "file", gr.Markdown()],
|
93 |
title="์ด๋ฏธ์ง ํํฐ ๋ฐ ํ๋ฐฑ ๋ณํ๊ธฐ",
|
94 |
+
description="์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํ๊ณ ํํฐ์ ๊ฐ๋๋ฅผ ์ ํํ๋ฉด, ๋ณํ๋ ์ด๋ฏธ์ง๋ฅผ JPG ํ์ผ๋ก ๋ค์ด๋ก๋ํ ์ ์์ต๋๋ค.",
|
95 |
+
live=True
|
96 |
)
|
97 |
|
98 |
+
def update_description(filter_type):
|
99 |
+
return get_filter_description(filter_type)
|
100 |
+
|
101 |
+
iface.inputs[1].change(fn=update_description, inputs=iface.inputs[1], outputs=iface.outputs[2])
|
102 |
+
|
103 |
iface.launch()
|