Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,10 @@ def upscale_image(input_image, radio_input):
|
|
7 |
upscale_factor = int(radio_input) # ์
์ค์ผ์ผ ๋น์จ์ ์ ์ํ์ผ๋ก ๋ณํ
|
8 |
# ์
๋ ฅ ์ด๋ฏธ์ง๋ฅผ ์ฃผ์ด์ง ์
์ค์ผ์ผ ๋น์จ๋ก ํฌ๊ธฐ ๋ณ๊ฒฝ (๋ณด๊ฐ๋ฒ: INTER_CUBIC)
|
9 |
output_image = cv2.resize(input_image, None, fx=upscale_factor, fy=upscale_factor, interpolation=cv2.INTER_CUBIC)
|
10 |
-
|
|
|
|
|
|
|
11 |
|
12 |
# ์ธํฐํ์ด์ค ์ค๋ช
|
13 |
DESCRIPTION = """
|
@@ -15,13 +18,13 @@ DESCRIPTION = """
|
|
15 |
"""
|
16 |
|
17 |
# ์
์ค์ผ์ผ ๋ ๋ฒจ ์ ํ ๋ผ๋์ค ๋ฒํผ
|
18 |
-
radio_input = gr.Radio(label="์
์ค์ผ์ผ ๋ ๋ฒจ ์ ํ (Select Upscaling level)", choices=[2, 4, 6, 8
|
19 |
|
20 |
# Gradio ์ธํฐํ์ด์ค ์ ์
|
21 |
demo = gr.Interface(
|
22 |
fn=upscale_image,
|
23 |
inputs=[gr.Image(label="์
๋ ฅ ์ด๋ฏธ์ง (Input Image)", type="numpy"), radio_input],
|
24 |
-
outputs=gr.Image(label="์
์ค์ผ์ผ๋ ์ด๋ฏธ์ง(Upscaled Image)"),
|
25 |
title="Image Upscaler",
|
26 |
description=DESCRIPTION
|
27 |
)
|
|
|
7 |
upscale_factor = int(radio_input) # ์
์ค์ผ์ผ ๋น์จ์ ์ ์ํ์ผ๋ก ๋ณํ
|
8 |
# ์
๋ ฅ ์ด๋ฏธ์ง๋ฅผ ์ฃผ์ด์ง ์
์ค์ผ์ผ ๋น์จ๋ก ํฌ๊ธฐ ๋ณ๊ฒฝ (๋ณด๊ฐ๋ฒ: INTER_CUBIC)
|
9 |
output_image = cv2.resize(input_image, None, fx=upscale_factor, fy=upscale_factor, interpolation=cv2.INTER_CUBIC)
|
10 |
+
# ์
์ค์ผ์ผ๋ ์ด๋ฏธ์ง๋ฅผ PNG ํ์ผ๋ก ์ ์ฅ
|
11 |
+
output_file_path = "/mnt/data/upscaled_image.png"
|
12 |
+
cv2.imwrite(output_file_path, output_image)
|
13 |
+
return output_image, output_file_path
|
14 |
|
15 |
# ์ธํฐํ์ด์ค ์ค๋ช
|
16 |
DESCRIPTION = """
|
|
|
18 |
"""
|
19 |
|
20 |
# ์
์ค์ผ์ผ ๋ ๋ฒจ ์ ํ ๋ผ๋์ค ๋ฒํผ
|
21 |
+
radio_input = gr.Radio(label="์
์ค์ผ์ผ ๋ ๋ฒจ ์ ํ (Select Upscaling level)", choices=[2, 4, 6, 8], value=2)
|
22 |
|
23 |
# Gradio ์ธํฐํ์ด์ค ์ ์
|
24 |
demo = gr.Interface(
|
25 |
fn=upscale_image,
|
26 |
inputs=[gr.Image(label="์
๋ ฅ ์ด๋ฏธ์ง (Input Image)", type="numpy"), radio_input],
|
27 |
+
outputs=[gr.Image(label="์
์ค์ผ์ผ๋ ์ด๋ฏธ์ง(Upscaled Image)"), gr.File(label="PNG ํ์ผ ๋ค์ด๋ก๋ (Download PNG File)")],
|
28 |
title="Image Upscaler",
|
29 |
description=DESCRIPTION
|
30 |
)
|