Update app.py
Browse files
app.py
CHANGED
|
@@ -36,16 +36,29 @@ def transform_image(image, contrast, brightness, blur):
|
|
| 36 |
|
| 37 |
def generate_comparison_html(original_base64, transformed_base64):
|
| 38 |
"""
|
| 39 |
-
๋ณํ๋ ์ด๋ฏธ์ง์ ์๋ณธ ์ด๋ฏธ์ง๋ฅผ ๋น๊ตํ ์ ์๋ ์ฌ๋ผ์ด๋ HTML์ ์์ฑํฉ๋๋ค.
|
| 40 |
๋ณํ๋ ์ด๋ฏธ์ง๋ฅผ ๊ธฐ์ค์ผ๋ก ์ฌ๋ผ์ด๋๋ฅผ ์์ง์ฌ ์๋ณธ ์ด๋ฏธ์ง๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
|
| 41 |
"""
|
| 42 |
html = f"""
|
| 43 |
<div style="position: relative; width: 100%; max-width: 600px; margin: auto;">
|
| 44 |
<img src="data:image/jpeg;base64,{transformed_base64}" style="width: 100%;">
|
| 45 |
-
<div id="overlay" style="position: absolute; top:0; left:0;
|
| 46 |
<img src="data:image/jpeg;base64,{original_base64}" style="width: 100%;">
|
| 47 |
</div>
|
| 48 |
-
<input type="range" min="0" max="100" value="50"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
<div style="text-align: center; margin-top: 10px;">
|
| 50 |
<span>๋ณํ ํ</span> <span style="float: right;">๋ณํ ์ </span>
|
| 51 |
</div>
|
|
@@ -79,7 +92,7 @@ def process_image(image, contrast, brightness, blur):
|
|
| 79 |
|
| 80 |
with gr.Blocks() as demo:
|
| 81 |
gr.Markdown("## ๐ธ ๋ถ์๊ธฐ ์๋ ํ๋ฐฑ ์ฌ์ง ๋ณํ๊ธฐ")
|
| 82 |
-
gr.Markdown("์๋ณธ ์ด๋ฏธ์ง์ ๋ณํ๋ ์ด๋ฏธ์ง๋ฅผ ์ฌ๋ผ์ด๋๋ก ๋น๊ตํ๊ณ , ๋ณํ๋ ์ด๋ฏธ์ง๋ฅผ ๋ค์ด๋ก๋ํ ์ ์์ต๋๋ค.")
|
| 83 |
|
| 84 |
with gr.Row():
|
| 85 |
with gr.Column():
|
|
|
|
| 36 |
|
| 37 |
def generate_comparison_html(original_base64, transformed_base64):
|
| 38 |
"""
|
| 39 |
+
๋ณํ๋ ์ด๋ฏธ์ง์ ์๋ณธ ์ด๋ฏธ์ง๋ฅผ ๋น๊ตํ ์ ์๋ ์์ง ์ฌ๋ผ์ด๋ HTML์ ์์ฑํฉ๋๋ค.
|
| 40 |
๋ณํ๋ ์ด๋ฏธ์ง๋ฅผ ๊ธฐ์ค์ผ๋ก ์ฌ๋ผ์ด๋๋ฅผ ์์ง์ฌ ์๋ณธ ์ด๋ฏธ์ง๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
|
| 41 |
"""
|
| 42 |
html = f"""
|
| 43 |
<div style="position: relative; width: 100%; max-width: 600px; margin: auto;">
|
| 44 |
<img src="data:image/jpeg;base64,{transformed_base64}" style="width: 100%;">
|
| 45 |
+
<div id="overlay" style="position: absolute; top:0; left:0; height:50%; overflow: hidden; width:100%;">
|
| 46 |
<img src="data:image/jpeg;base64,{original_base64}" style="width: 100%;">
|
| 47 |
</div>
|
| 48 |
+
<input type="range" min="0" max="100" value="50"
|
| 49 |
+
oninput="document.getElementById('overlay').style.height = this.value + '%';"
|
| 50 |
+
style="
|
| 51 |
+
position: absolute;
|
| 52 |
+
top: 10px;
|
| 53 |
+
right: 10px;
|
| 54 |
+
transform: rotate(270deg);
|
| 55 |
+
transform-origin: center;
|
| 56 |
+
width: 300px;
|
| 57 |
+
height: 80px;
|
| 58 |
+
-webkit-appearance: slider-vertical;
|
| 59 |
+
writing-mode: bt-lr; /* IE */
|
| 60 |
+
background: transparent;
|
| 61 |
+
">
|
| 62 |
<div style="text-align: center; margin-top: 10px;">
|
| 63 |
<span>๋ณํ ํ</span> <span style="float: right;">๋ณํ ์ </span>
|
| 64 |
</div>
|
|
|
|
| 92 |
|
| 93 |
with gr.Blocks() as demo:
|
| 94 |
gr.Markdown("## ๐ธ ๋ถ์๊ธฐ ์๋ ํ๋ฐฑ ์ฌ์ง ๋ณํ๊ธฐ")
|
| 95 |
+
gr.Markdown("์๋ณธ ์ด๋ฏธ์ง์ ๋ณํ๋ ์ด๋ฏธ์ง๋ฅผ ์์ง ์ฌ๋ผ์ด๋๋ก ๋น๊ตํ๊ณ , ๋ณํ๋ ์ด๋ฏธ์ง๋ฅผ ๋ค์ด๋ก๋ํ ์ ์์ต๋๋ค.")
|
| 96 |
|
| 97 |
with gr.Row():
|
| 98 |
with gr.Column():
|