Update app.py
Browse files
app.py
CHANGED
@@ -69,7 +69,11 @@ def convert_and_save(image, filter_type, intensity):
|
|
69 |
original_image_pil = Image.fromarray(cv2.cvtColor(image_cv, cv2.COLOR_BGR2RGB))
|
70 |
filtered_image_pil = Image.fromarray(cv2.cvtColor(filtered_image, cv2.COLOR_BGR2RGB))
|
71 |
|
72 |
-
|
|
|
|
|
|
|
|
|
73 |
|
74 |
def get_filter_description(filter_type):
|
75 |
descriptions = {
|
@@ -98,6 +102,7 @@ with gr.Blocks() as iface:
|
|
98 |
|
99 |
with gr.Column():
|
100 |
slider_output = ImageSlider(label="Before and After", type="pil")
|
|
|
101 |
|
102 |
filter_input.change(fn=get_filter_description, inputs=filter_input, outputs=description_output)
|
103 |
|
@@ -105,7 +110,7 @@ with gr.Blocks() as iface:
|
|
105 |
process_button.click(
|
106 |
fn=convert_and_save,
|
107 |
inputs=[image_input, filter_input, intensity_slider],
|
108 |
-
outputs=slider_output
|
109 |
)
|
110 |
|
111 |
iface.title = "์ธ๋ฌผ ์ฌ์ง์ ์ต์ ํ๋ ํํฐ"
|
|
|
69 |
original_image_pil = Image.fromarray(cv2.cvtColor(image_cv, cv2.COLOR_BGR2RGB))
|
70 |
filtered_image_pil = Image.fromarray(cv2.cvtColor(filtered_image, cv2.COLOR_BGR2RGB))
|
71 |
|
72 |
+
# ํํฐ ์ ์ฉ๋ ์ด๋ฏธ์ง๋ฅผ JPG๋ก ์ ์ฅ
|
73 |
+
output_path = "filtered_image.jpg"
|
74 |
+
filtered_image_pil.save(output_path)
|
75 |
+
|
76 |
+
return original_image_pil, filtered_image_pil, output_path # ์๋ณธ, ํํฐ ์ ์ฉ๋ ์ด๋ฏธ์ง์ ํ์ผ ๊ฒฝ๋ก ๋ฐํ
|
77 |
|
78 |
def get_filter_description(filter_type):
|
79 |
descriptions = {
|
|
|
102 |
|
103 |
with gr.Column():
|
104 |
slider_output = ImageSlider(label="Before and After", type="pil")
|
105 |
+
download_link = gr.File(label="Download Filtered Image")
|
106 |
|
107 |
filter_input.change(fn=get_filter_description, inputs=filter_input, outputs=description_output)
|
108 |
|
|
|
110 |
process_button.click(
|
111 |
fn=convert_and_save,
|
112 |
inputs=[image_input, filter_input, intensity_slider],
|
113 |
+
outputs=[slider_output, download_link]
|
114 |
)
|
115 |
|
116 |
iface.title = "์ธ๋ฌผ ์ฌ์ง์ ์ต์ ํ๋ ํํฐ"
|