Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,41 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
import cv2
|
3 |
import numpy as np
|
4 |
from PIL import Image, ExifTags
|
5 |
|
6 |
-
|
7 |
st.set_page_config(page_title="๋ฅํ์ดํฌ ์ฌ์ ๋ฐฉ์ง ํํฐ(ํ
์คํธ)", layout="wide")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
st.title("๋ฅํ์ดํฌ ์ฌ์ ๋ฐฉ์ง ํํฐ(ํ
์คํธ)")
|
9 |
-
st.markdown("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
st.markdown(
|
11 |
"""
|
|
|
12 |
<style>
|
13 |
.stFileUploader label {
|
14 |
font-size: 20px;
|
@@ -91,7 +118,6 @@ st.markdown(
|
|
91 |
unsafe_allow_html=True,
|
92 |
)
|
93 |
|
94 |
-
|
95 |
def change_hair_to_blonde(image):
|
96 |
# Convert to OpenCV format
|
97 |
image = np.array(image)
|
@@ -154,15 +180,15 @@ if uploaded_file is not None:
|
|
154 |
|
155 |
with col1:
|
156 |
st.image(image, use_column_width=True)
|
157 |
-
st.markdown('<div class="custom-caption-1"
|
158 |
|
159 |
with col2:
|
160 |
st.image(image, use_column_width=True)
|
161 |
-
st.markdown('<div class="custom-caption-1"
|
162 |
-
|
163 |
button_clicked = st.button("์๋จ์ ๋ ์ฌ์ง์ ๋ฅํ์ดํฌ ๋ชจ๋ธ์ ํ์ต์ํค๊ธฐ")
|
164 |
st.markdown('<p class="survey">์ ์๋น์ค๋ฅผ ์ฌ์ฉํด ๋ณด์
จ๊ฑฐ๋, ์ ํฌ ๊ธฐ์ ์ ์๋ฆฌ์ ๊ด์ฌ์ด ์์ผ์ ๋ถ๋ค๊ป์ ์๋์ ๊ฐ๋จํ ์ธํฐ๋ทฐ์ ์ฐธ์ฌํด ์ฃผ์๋ฉด ์ง์ฌ์ผ๋ก ๊ฐ์ฌ๋๋ฆฌ๊ฒ ์ต๋๋ค.</p>', unsafe_allow_html=True)
|
165 |
-
st.markdown('<p class="survey-1"><a href="https://docs.google.com/forms/d/e/1FAIpQLSdzRtuvQyp3CQDhlxEag40v2yDM7u9NYpJ2gv5kgwuNbo1gUA/viewform?usp=sf_link" target="_blank" class="a-tag"
|
166 |
st.markdown('<p class="survey-2">์๋น์ค๋ฅผ ์ด์ฉํด ์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค! ์ข์ ํ๋ฃจ ๋ณด๋ด์ธ์!</p>', unsafe_allow_html=True)
|
167 |
|
168 |
if button_clicked:
|
@@ -170,9 +196,10 @@ if uploaded_file is not None:
|
|
170 |
processed_image = change_hair_to_blonde(image)
|
171 |
st.image(processed_image, use_column_width=True)
|
172 |
st.markdown('<div class="custom-caption-2">์๋ณธ ์ด๋ฏธ์ง๋ฅผ ๋ฅํ์ดํฌ ๋ชจ๋ธ์ ๋ฃ์์ ๊ฒฝ์ฐ</div>', unsafe_allow_html=True)
|
|
|
173 |
|
174 |
with col2:
|
175 |
deepfake_image = add_noise(image)
|
176 |
st.image(deepfake_image, use_column_width=True)
|
177 |
st.markdown('<div class="custom-caption-2">์ฌ์ ๋ฐฉ์ง ํํฐ ์ด๋ฏธ์ง๋ฅผ ๋ฅํ์ดํฌ ๋ชจ๋ธ์ ๋ฃ์์ ๊ฒฝ์ฐ</div>', unsafe_allow_html=True)
|
178 |
-
|
|
|
1 |
import streamlit as st
|
2 |
+
import streamlit.components.v1 as components
|
3 |
import cv2
|
4 |
import numpy as np
|
5 |
from PIL import Image, ExifTags
|
6 |
|
7 |
+
# ๊ฐ์ฅ ๋จผ์ set_page_config() ํธ์ถ
|
8 |
st.set_page_config(page_title="๋ฅํ์ดํฌ ์ฌ์ ๋ฐฉ์ง ํํฐ(ํ
์คํธ)", layout="wide")
|
9 |
+
|
10 |
+
|
11 |
+
ga_code = """
|
12 |
+
<!-- Global site tag (gtag.js) - Google Analytics -->
|
13 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-PZPBGNENQG"></script>
|
14 |
+
<script>
|
15 |
+
window.dataLayer = window.dataLayer || [];
|
16 |
+
function gtag(){dataLayer.push(arguments);}
|
17 |
+
gtag('js', new Date());
|
18 |
+
gtag('config', 'G-PZPBGNENQG');
|
19 |
+
</script>
|
20 |
+
"""
|
21 |
+
|
22 |
+
# Streamlit์ GA ์ฝ๋ ์ฝ์
|
23 |
+
components.html(ga_code, height=0)
|
24 |
+
|
25 |
+
# ๋๋จธ์ง Streamlit ์ฝ๋
|
26 |
st.title("๋ฅํ์ดํฌ ์ฌ์ ๋ฐฉ์ง ํํฐ(ํ
์คํธ)")
|
27 |
+
st.markdown("")
|
28 |
+
st.markdown("<span style='font-size: 18px;'>์๋
ํ์ธ์! ์ ํฌ๋ ๋ฅํ์ดํฌ๋ก๋ถํฐ ์ฌ๋ฌ๋ถ์ ์ฌ์ง์ ๋ณดํธํ๋ ์๋ฃจ์
์ ๊ฐ๋ฐํ๊ณ ์์ต๋๋ค.</span>", unsafe_allow_html=True)
|
29 |
+
st.markdown("<span style='font-size: 18px;'>์ ํฌ์ ๋ชฉํ๋ ์จ๋ผ์ธ์ ๊ฒ์๋ ๊ฐ์ธ์ ์ฌ์ง์ด ์
์ฑ ๋ฅํ์ดํฌ ์์์ ์ฌ์ฉ๋์ง ์๋๋ก ํ๋ ๊ฒ์
๋๋ค. ํ์ฌ๋ ๊ฐ๋ฐ์ ๋ง๋ฌด๋ฆฌํ๊ณ ์๋น์คํ ํ๊ธฐ ์ , ์ฌ๋ฌ๋ถ์ ์๊ฒฌ์ ๋ฃ๊ธฐ ์ํด ๊ฐ๋จํ ํ
์คํธ๋ฅผ ์งํํ๊ณ ์์ต๋๋ค.</span>", unsafe_allow_html=True)
|
30 |
+
st.markdown("<span style='font-size: 18px;'>์ต๊ทผ SNS์ ์
๋ก๋๋ ์ด๋ฏธ์ง๊ฐ ๋ฅํ์ดํฌ ํฌ๋ฅด๋
ธ๋ฌผ์ ์
์ฉ๋๋ ์ฌ๋ก๊ฐ ๋งค์ผ ๋ณด๊ณ ๋๊ณ ์์ต๋๋ค. ๋ฐ๋ผ์ ํด๊ฒฐ์ฑ
์ ๊ฐ๊ตฌํ๊ธฐ ์ํด, ์ฌ๋ฌ๋ถ์ ์์คํ ์๊ฒฌ์ด ํ์ํฉ๋๋ค.</span>", unsafe_allow_html=True)
|
31 |
+
st.markdown("<span style='font-size: 18px;'>์๋ ๋งํฌ๋ฅผ ํตํด ์ ํฌ ์๋น์ค๋ฅผ ์ด์ฉํด ๋ณด์ ํ, ์ธํฐ๋ทฐ์ ์ฐธ์ฌํด ์ฃผ์๋ฉด ํฐ ๋์์ด ๋๊ฒ ์ต๋๋ค. ์ฌ๋ฌ๋ถ์ ํผ๋๋ฐฑ์ ์๋น์ค ๊ฐ์ ์ ๊ท์คํ ์๋ฃ๊ฐ ๋ ๊ฒ์
๋๋ค.</span>", unsafe_allow_html=True)
|
32 |
+
st.markdown("")
|
33 |
+
st.markdown("<span style='font-size: 18px;'>๋์ ์๋ฆฌ : 1. ์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํ๋ฉด, ์ฌ์ ๋ฐฉ์ง ํํฐ๊ฐ ์ ์ฉ๋ ์ด๋ฏธ์ง๋ฅผ ๋ณด์ฌ๋๋ฆฝ๋๋ค. 2. ํ๋จ์ ํฐ ๋ฒํผ์ ํด๋ฆญํ๋ฉด ๋ฅํ์ดํฌ ๋ชจ๋ธ์ ํตํด ์์ฑ๋ ๊ฒฐ๊ณผ๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.</span>", unsafe_allow_html=True)
|
34 |
+
st.markdown("<span style='font-size: 18px;'>์ฌ๋ฌ๋ถ์ ์ฐธ์ฌ์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค!</span>", unsafe_allow_html=True)
|
35 |
+
st.markdown("<span style='font-size: 14px;'> *์ฌ์ ๋ฐฉ์ง ํํฐ๋: ์ฌ๋ฌ๋ถ์ ์ฌ์ง์ด ๋ฅํ์ดํฌ ๋ชจ๋ธ์ ํ์ต๋์ง ๋ชปํ๋๋ก ๋ฐฉํดํ๋ ๋
ธ์ด์ฆ(noise)ํํ์ ํํฐ.</span>", unsafe_allow_html=True)
|
36 |
st.markdown(
|
37 |
"""
|
38 |
+
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet">
|
39 |
<style>
|
40 |
.stFileUploader label {
|
41 |
font-size: 20px;
|
|
|
118 |
unsafe_allow_html=True,
|
119 |
)
|
120 |
|
|
|
121 |
def change_hair_to_blonde(image):
|
122 |
# Convert to OpenCV format
|
123 |
image = np.array(image)
|
|
|
180 |
|
181 |
with col1:
|
182 |
st.image(image, use_column_width=True)
|
183 |
+
st.markdown('<div class="custom-caption-1">์
๋ก๋ํ ์ด๋ฏธ์ง</div>', unsafe_allow_html=True)
|
184 |
|
185 |
with col2:
|
186 |
st.image(image, use_column_width=True)
|
187 |
+
st.markdown('<div class="custom-caption-1">ํํฐ๋ฅผ ์
ํ ์ด๋ฏธ์ง</div>', unsafe_allow_html=True)
|
188 |
+
|
189 |
button_clicked = st.button("์๋จ์ ๋ ์ฌ์ง์ ๋ฅํ์ดํฌ ๋ชจ๋ธ์ ํ์ต์ํค๊ธฐ")
|
190 |
st.markdown('<p class="survey">์ ์๋น์ค๋ฅผ ์ฌ์ฉํด ๋ณด์
จ๊ฑฐ๋, ์ ํฌ ๊ธฐ์ ์ ์๋ฆฌ์ ๊ด์ฌ์ด ์์ผ์ ๋ถ๋ค๊ป์ ์๋์ ๊ฐ๋จํ ์ธํฐ๋ทฐ์ ์ฐธ์ฌํด ์ฃผ์๋ฉด ์ง์ฌ์ผ๋ก ๊ฐ์ฌ๋๋ฆฌ๊ฒ ์ต๋๋ค.</p>', unsafe_allow_html=True)
|
191 |
+
st.markdown('<p class="survey-1"><a href="https://docs.google.com/forms/d/e/1FAIpQLSdzRtuvQyp3CQDhlxEag40v2yDM7u9NYpJ2gv5kgwuNbo1gUA/viewform?usp=sf_link" target="_blank" class="a-tag">์ฌ๊ธฐ๋ฅผ ํด๋ฆญํ์ฌ ์ธํฐ๋ทฐ์ ์ํด ์ฃผ์ ๋ค๋ฉด ํฐ ๋์์ด ๋ ๊ฒ ๊ฐ์ต๋๋ค!!</a></p>', unsafe_allow_html=True)
|
192 |
st.markdown('<p class="survey-2">์๋น์ค๋ฅผ ์ด์ฉํด ์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค! ์ข์ ํ๋ฃจ ๋ณด๋ด์ธ์!</p>', unsafe_allow_html=True)
|
193 |
|
194 |
if button_clicked:
|
|
|
196 |
processed_image = change_hair_to_blonde(image)
|
197 |
st.image(processed_image, use_column_width=True)
|
198 |
st.markdown('<div class="custom-caption-2">์๋ณธ ์ด๋ฏธ์ง๋ฅผ ๋ฅํ์ดํฌ ๋ชจ๋ธ์ ๋ฃ์์ ๊ฒฝ์ฐ</div>', unsafe_allow_html=True)
|
199 |
+
st.markdown("<span>์ดํด๋ฅผ ๋๊ธฐ ์ํด ์ฌ์ง์ ๋
ธ๋์์ ์
ํ๋ ๋ฅํ์ดํฌ ์๊ณ ๋ฆฌ์ฆ ์ ์ฉ. ์๋ณธ ์ด๋ฏธ์ง๋ ๋ฅํ์ดํฌ ์๊ณ ๋ฆฌ์ฆ์ ์ํฅ์ ๋ฐ์.</span>", unsafe_allow_html=True)
|
200 |
|
201 |
with col2:
|
202 |
deepfake_image = add_noise(image)
|
203 |
st.image(deepfake_image, use_column_width=True)
|
204 |
st.markdown('<div class="custom-caption-2">์ฌ์ ๋ฐฉ์ง ํํฐ ์ด๋ฏธ์ง๋ฅผ ๋ฅํ์ดํฌ ๋ชจ๋ธ์ ๋ฃ์์ ๊ฒฝ์ฐ</div>', unsafe_allow_html=True)
|
205 |
+
st.markdown("<span>์ฌ์ ๋ฐฉ์ง ํํฐ๋ฅผ ์
ํ ์ด๋ฏธ์ง๋ ๋ฅํ์ดํฌ ์๊ณ ๋ฆฌ์ฆ์ ์ํฅ์ ๋ฐ์ง ์๊ณ ๋
ธ์ด์ฆ ์ฒ๋ฆฌ๊ฐ ๋์ด ์์๋ณด๊ธฐ ํ๋ ์ฌ์ง์ ์ถ๋ ฅ. ์ฆ, ๋ฅํ์ดํฌ ์ฌ์ง ํฉ์ฑ์ ๋ฐฉํดํจ.</span>", unsafe_allow_html=True)
|