minhwai commited on
Commit
03db935
ยท
verified ยท
1 Parent(s): 6b14869

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +147 -61
app.py CHANGED
@@ -24,44 +24,145 @@ components.html(ga_code, height=0)
24
  # ๋ฐ˜์‘ํ˜• ๋””์ž์ธ์„ ์œ„ํ•œ CSS
25
  css = """
26
  <style>
27
- .container {
28
- display: grid;
29
- grid-template-columns: 1fr 1fr;
30
- gap: 20px;
31
- align-items: center;
32
- justify-items: center;
33
  }
34
-
35
- .custom-caption-1, .custom-caption-2, .survey, .survey-1, .survey-2, span {
 
 
 
 
36
  font-size: 20px;
 
 
 
 
 
 
 
 
 
37
  font-weight: bold;
38
  text-align: center;
39
  margin-top: 10px;
40
- color: black;
41
- display: block;
42
  }
43
-
44
- .bottom-space {
45
- height: 5em; /* ์—ฌ๋ฐฑ์„ ์œ„ํ•œ ๊ณต๊ฐ„ */
 
 
 
46
  }
47
-
48
- .center-align {
49
  text-align: center;
 
50
  }
51
-
52
  .stButton button {
 
 
 
 
 
 
 
 
 
 
 
53
  display: block;
54
- margin: 0 auto;
55
  }
56
-
57
- @media only screen and (max-width: 768px) {
58
- .container {
59
- grid-template-columns: 1fr;
60
- }
61
-
62
- .custom-caption-1, .custom-caption-2 {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  font-size: 16px;
64
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  }
66
  </style>
67
  """
@@ -138,45 +239,30 @@ if uploaded_file is not None:
138
  # Save the original image as a numpy array
139
  image_np = np.array(image)
140
 
141
- st.markdown('<div class="container">', unsafe_allow_html=True)
142
-
143
- st.markdown('<div class="center-align">', unsafe_allow_html=True)
144
- st.image(image, use_column_width=True)
145
- st.markdown('<div class="custom-caption-1">์—…๋กœ๋“œํ•œ ์ด๋ฏธ์ง€</div>', unsafe_allow_html=True)
146
- st.markdown('</div>', unsafe_allow_html=True)
147
-
148
- st.markdown('<div class="center-align">', unsafe_allow_html=True)
149
- st.image(image, use_column_width=True)
150
- st.markdown('<div class="custom-caption-1">ํ•„ํ„ฐ๋ฅผ ์ž…ํžŒ ์ด๋ฏธ์ง€</div>', unsafe_allow_html=True)
151
- st.markdown('</div>', unsafe_allow_html=True)
152
 
153
- st.markdown('</div>', unsafe_allow_html=True)
 
 
154
 
155
- button_clicked = st.button("์ƒ๋‹จ์˜ ๋‘ ์‚ฌ์ง„์„ ๋”ฅํŽ˜์ดํฌ ๋ชจ๋ธ์— ํ•™์Šต์‹œํ‚ค๊ธฐ", key="deepfake_button")
 
 
 
156
 
157
  if button_clicked:
158
- st.markdown('<div class="container">', unsafe_allow_html=True)
159
-
160
- st.markdown('<div class="center-align">', unsafe_allow_html=True)
161
- processed_image = change_hair_to_blonde(image)
162
- st.image(processed_image, use_column_width=True)
163
- st.markdown('<div class="custom-caption-2">์›๋ณธ ์ด๋ฏธ์ง€๋ฅผ ๋”ฅํŽ˜์ดํฌ ๋ชจ๋ธ์— ๋„ฃ์—ˆ์„ ๊ฒฝ์šฐ</div>', unsafe_allow_html=True)
164
- st.markdown("<span>์ดํ•ด๋ฅผ ๋•๊ธฐ ์œ„ํ•ด ์‚ฌ์ง„์— ๋…ธ๋ž€์ƒ‰์„ ์ž…ํžˆ๋Š” ๋”ฅํŽ˜์ดํฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์ ์šฉ. ์›๋ณธ ์ด๋ฏธ์ง€๋Š” ๋”ฅํŽ˜์ดํฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜์˜ ์˜ํ–ฅ์„ ๋ฐ›์Œ.</span>", unsafe_allow_html=True)
165
- st.markdown('</div>', unsafe_allow_html=True)
166
 
167
- st.markdown('<div class="center-align">', unsafe_allow_html=True)
168
- deepfake_image = add_noise(image)
169
- st.image(deepfake_image, use_column_width=True)
170
- st.markdown('<div class="custom-caption-2">์‚ฌ์ „ ๋ฐฉ์ง€ ํ•„ํ„ฐ ์ด๋ฏธ์ง€๋ฅผ ๋”ฅํŽ˜์ดํฌ ๋ชจ๋ธ์— ๋„ฃ์—ˆ์„ ๊ฒฝ์šฐ</div>', unsafe_allow_html=True)
171
- st.markdown("<span>์‚ฌ์ „ ๋ฐฉ์ง€ ํ•„ํ„ฐ๋ฅผ ์ž…ํžŒ ์ด๋ฏธ์ง€๋Š” ๋”ฅํŽ˜์ดํฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜์˜ ์˜ํ–ฅ์„ ๋ฐ›์ง€ ์•Š๊ณ  ๋…ธ์ด์ฆˆ ์ฒ˜๋ฆฌ๊ฐ€ ๋˜์–ด ์•Œ์•„๋ณด๊ธฐ ํž˜๋“  ์‚ฌ์ง„์„ ์ถœ๋ ฅ. ์ฆ‰, ๋”ฅํŽ˜์ดํฌ ์‚ฌ์ง„ ํ•ฉ์„ฑ์„ ๋ฐฉํ•ดํ•จ.</span>", unsafe_allow_html=True)
172
- st.markdown('</div>', unsafe_allow_html=True)
173
-
174
- st.markdown('</div>', unsafe_allow_html=True)
175
-
176
- # ์ธํ„ฐ๋ทฐ ๊ด€๋ จ ๋ฌธ๊ตฌ๋ฅผ ๋ฒ„ํŠผ ํด๋ฆญ ํ›„ ์•„๋ž˜์— ํ‘œ์‹œ
177
- st.markdown('<p class="survey">์œ„ ์„œ๋น„์Šค๋ฅผ ์‚ฌ์šฉํ•ด ๋ณด์…จ๊ฑฐ๋‚˜, ์ €ํฌ ๊ธฐ์ˆ ์  ์›๋ฆฌ์— ๊ด€์‹ฌ์ด ์žˆ์œผ์‹  ๋ถ„๋“ค๊ป˜์„  ์•„๋ž˜์˜ ๊ฐ„๋‹จํ•œ ์ธํ„ฐ๋ทฐ์— ์ฐธ์—ฌํ•ด ์ฃผ์‹œ๋ฉด ์ง„์‹ฌ์œผ๋กœ ๊ฐ์‚ฌ๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค.</p>', unsafe_allow_html=True)
178
- 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)
179
- st.markdown('<p class="survey-2">์„œ๋น„์Šค๋ฅผ ์ด์šฉํ•ด ์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค! ์ข‹์€ ํ•˜๋ฃจ ๋ณด๋‚ด์„ธ์š”!</p>', unsafe_allow_html=True)
180
-
181
- # ์—ฌ๋ฐฑ์„ ์ถ”๊ฐ€
182
- st.markdown('<div class="bottom-space"></div>', unsafe_allow_html=True)
 
24
  # ๋ฐ˜์‘ํ˜• ๋””์ž์ธ์„ ์œ„ํ•œ CSS
25
  css = """
26
  <style>
27
+ /* ๊ณตํ†ต ์Šคํƒ€์ผ */
28
+ .stFileUploader label,
29
+ .stRadio label,
30
+ .stButton button,
31
+ .survey-1 {
32
+ transition: all 0.3s ease;
33
  }
34
+ .stFileUploader label {
35
+ font-size: 20px;
36
+ font-weight: 500;
37
+ color: #1f77b4;
38
+ }
39
+ .stRadio label {
40
  font-size: 20px;
41
+ font-weight: 500;
42
+ color: #1f77b4;
43
+ }
44
+ .stRadio div {
45
+ display: flex;
46
+ gap: 20px;
47
+ }
48
+ .custom-caption-1 {
49
+ font-size: 36px;
50
  font-weight: bold;
51
  text-align: center;
52
  margin-top: 10px;
53
+ padding: 0 0 20px 0;
 
54
  }
55
+ .custom-caption-2 {
56
+ font-size: 36px;
57
+ font-weight: bold;
58
+ text-align: center;
59
+ margin-top: 10px;
60
+ padding: 0 0 30px 0;
61
  }
62
+ .button-container {
 
63
  text-align: center;
64
+ margin-top: 30px;
65
  }
 
66
  .stButton button {
67
+ width: 50%;
68
+ font-size: 25px;
69
+ padding: 10px 20px;
70
+ background-color: #FFFFFF;
71
+ font-weight: bold;
72
+ color: black;
73
+ opacity: 0.8;
74
+ border: 3px solid black;
75
+ border-radius: 5px;
76
+ cursor: pointer;
77
+ margin: 0 auto 50px auto;
78
  display: block;
 
79
  }
80
+ .stButton button:hover {
81
+ background-color: #FFFFFF;
82
+ border: 3px solid #FF0080;
83
+ color: #FF0080;
84
+ opacity: 1;
85
+ }
86
+ .survey {
87
+ text-align: center;
88
+ margin-top: 10px
89
+ }
90
+ .survey-1 {
91
+ font-size: 25px;
92
+ text-align: center;
93
+ margin-top: 10px;
94
+ font-weight: bold;
95
+ }
96
+ .survey-2 {
97
+ text-align: center;
98
+ margin-top: 10px;
99
+ font-weight: bold;
100
+ padding: 0 auto 50px auto;
101
+ }
102
+ .a-tag {
103
+ color: #FF0080;
104
+ text-decoration: none;
105
+ }
106
+ a:hover {
107
+ color: #FF0080;
108
+ text-decoration: none;
109
+ }
110
+
111
+ /* ์Šค๋งˆํŠธํฐ ํ™”๋ฉด ์Šคํƒ€์ผ */
112
+ @media only screen and (max-width: 600px) {
113
+ .stFileUploader label,
114
+ .stRadio label,
115
+ .stButton button,
116
+ .survey-1 {
117
  font-size: 16px;
118
  }
119
+ .custom-caption-1,
120
+ .custom-caption-2 {
121
+ font-size: 24px;
122
+ padding: 0 0 20px 0;
123
+ }
124
+ .stButton button {
125
+ width: 100%;
126
+ font-size: 18px;
127
+ }
128
+ }
129
+
130
+ /* ํƒœ๋ธ”๋ฆฟ ํ™”๋ฉด ์Šคํƒ€์ผ */
131
+ @media only screen and (min-width: 601px) and (max-width: 1024px) {
132
+ .stFileUploader label,
133
+ .stRadio label,
134
+ .stButton button,
135
+ .survey-1 {
136
+ font-size: 18px;
137
+ }
138
+ .custom-caption-1,
139
+ .custom-caption-2 {
140
+ font-size: 28px;
141
+ padding: 0 0 40px 0;
142
+ }
143
+ .stButton button {
144
+ width: 75%;
145
+ font-size: 20px;
146
+ }
147
+ }
148
+
149
+ /* ๋ฐ์Šคํฌํ†ฑ ํ™”๋ฉด ์Šคํƒ€์ผ */
150
+ @media only screen and (min-width: 1025px) {
151
+ .stFileUploader label,
152
+ .stRadio label,
153
+ .stButton button,
154
+ .survey-1 {
155
+ font-size: 20px;
156
+ }
157
+ .custom-caption-1,
158
+ .custom-caption-2 {
159
+ font-size: 36px;
160
+ padding: 0 0 200px 0;
161
+ }
162
+ .stButton button {
163
+ width: 50%;
164
+ font-size: 25px;
165
+ }
166
  }
167
  </style>
168
  """
 
239
  # Save the original image as a numpy array
240
  image_np = np.array(image)
241
 
242
+ col1, col2 = st.columns(2)
243
+
244
+ with col1:
245
+ st.image(image, use_column_width=True)
246
+ st.markdown('<div class="custom-caption-1">์—…๋กœ๋“œํ•œ ์ด๋ฏธ์ง€</div>', unsafe_allow_html=True)
 
 
 
 
 
 
247
 
248
+ with col2:
249
+ st.image(image, use_column_width=True)
250
+ st.markdown('<div class="custom-caption-1">ํ•„ํ„ฐ๋ฅผ ์ž…ํžŒ ์ด๋ฏธ์ง€</div>', unsafe_allow_html=True)
251
 
252
+ button_clicked = st.button("์ƒ๋‹จ์˜ ๋‘ ์‚ฌ์ง„์„ ๋”ฅํŽ˜์ดํฌ ๋ชจ๋ธ์— ํ•™์Šต์‹œํ‚ค๊ธฐ")
253
+ st.markdown('<p class="survey">์œ„ ์„œ๋น„์Šค๋ฅผ ์‚ฌ์šฉํ•ด ๋ณด์…จ๊ฑฐ๋‚˜, ์ €ํฌ ๊ธฐ์ˆ ์  ์›๋ฆฌ์— ๊ด€์‹ฌ์ด ์žˆ์œผ์‹  ๋ถ„๋“ค๊ป˜์„  ์•„๋ž˜์˜ ๊ฐ„๋‹จํ•œ ์ธํ„ฐ๋ทฐ์— ์ฐธ์—ฌํ•ด ์ฃผ์‹œ๋ฉด ์ง„์‹ฌ์œผ๋กœ ๊ฐ์‚ฌ๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค.</p>', unsafe_allow_html=True)
254
+ 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)
255
+ st.markdown('<p class="survey-2">์„œ๋น„์Šค๋ฅผ ์ด์šฉํ•ด ์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค! ์ข‹์€ ํ•˜๋ฃจ ๋ณด๋‚ด์„ธ์š”!</p>', unsafe_allow_html=True)
256
 
257
  if button_clicked:
258
+ with col1:
259
+ processed_image = change_hair_to_blonde(image)
260
+ st.image(processed_image, use_column_width=True)
261
+ st.markdown('<div class="custom-caption-2">์›๋ณธ ์ด๋ฏธ์ง€๋ฅผ ๋”ฅํŽ˜์ดํฌ ๋ชจ๋ธ์— ๋„ฃ์—ˆ์„ ๊ฒฝ์šฐ</div>', unsafe_allow_html=True)
262
+ st.markdown("<span>์ดํ•ด๋ฅผ ๋•๊ธฐ ์œ„ํ•ด ์‚ฌ์ง„์— ๋…ธ๋ž€์ƒ‰์„ ์ž…ํžˆ๋Š” ๋”ฅํŽ˜์ดํฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์ ์šฉ. ์›๋ณธ ์ด๋ฏธ์ง€๋Š” ๋”ฅํŽ˜์ดํฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜์˜ ์˜ํ–ฅ์„ ๋ฐ›์Œ.</span>", unsafe_allow_html=True)
 
 
 
263
 
264
+ with col2:
265
+ deepfake_image = add_noise(image)
266
+ st.image(deepfake_image, use_column_width=True)
267
+ st.markdown('<div class="custom-caption-2">์‚ฌ์ „ ๋ฐฉ์ง€ ํ•„ํ„ฐ ์ด๋ฏธ์ง€๋ฅผ ๋”ฅํŽ˜์ดํฌ ๋ชจ๋ธ์— ๋„ฃ์—ˆ์„ ๊ฒฝ์šฐ</div>', unsafe_allow_html=True)
268
+ st.markdown("<span>์‚ฌ์ „ ๋ฐฉ์ง€ ํ•„ํ„ฐ๋ฅผ ์ž…ํžŒ ์ด๋ฏธ์ง€๋Š” ๋”ฅํŽ˜์ดํฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜์˜ ์˜ํ–ฅ์„ ๋ฐ›์ง€ ์•Š๊ณ  ๋…ธ์ด์ฆˆ ์ฒ˜๋ฆฌ๊ฐ€ ๋˜์–ด ์•Œ์•„๋ณด๊ธฐ ํž˜๋“  ์‚ฌ์ง„์„ ์ถœ๋ ฅ. ์ฆ‰, ๋”ฅํŽ˜์ดํฌ ์‚ฌ์ง„ ํ•ฉ์„ฑ์„ ๋ฐฉํ•ดํ•จ.</span>", unsafe_allow_html=True)