minhwai commited on
Commit
1a1812a
ยท
verified ยท
1 Parent(s): f586132

Update app.py

Browse files

"grid๋กœ ๋ฐ˜์‘ํ˜• ๋งŒ๋“ค์–ด๋ณด๊ธฐ"

Files changed (1) hide show
  1. app.py +44 -149
app.py CHANGED
@@ -24,144 +24,29 @@ components.html(ga_code, height=0)
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>
@@ -239,15 +124,19 @@ if uploaded_file is not None:
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)
@@ -255,14 +144,20 @@ if uploaded_file is not None:
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)
 
 
 
 
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 {
36
+ font-size: 20px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  font-weight: bold;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  text-align: center;
39
  margin-top: 10px;
40
+ color: white;
41
  }
42
+
43
+ @media only screen and (max-width: 768px) {
44
+ .container {
45
+ grid-template-columns: 1fr;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
+
48
+ .custom-caption-1, .custom-caption-2 {
49
+ font-size: 16px;
50
  }
51
  }
52
  </style>
 
124
  # Save the original image as a numpy array
125
  image_np = np.array(image)
126
 
127
+ st.markdown('<div class="container">', unsafe_allow_html=True)
128
+
129
+ st.markdown('<div>', unsafe_allow_html=True)
130
+ st.image(image, use_column_width=True)
131
+ st.markdown('<div class="custom-caption-1">์—…๋กœ๋“œํ•œ ์ด๋ฏธ์ง€</div>', unsafe_allow_html=True)
132
+ st.markdown('</div>', unsafe_allow_html=True)
133
+
134
+ st.markdown('<div>', unsafe_allow_html=True)
135
+ st.image(image, use_column_width=True)
136
+ st.markdown('<div class="custom-caption-1">ํ•„ํ„ฐ๋ฅผ ์ž…ํžŒ ์ด๋ฏธ์ง€</div>', unsafe_allow_html=True)
137
+ st.markdown('</div>', unsafe_allow_html=True)
138
 
139
+ st.markdown('</div>', unsafe_allow_html=True)
 
 
140
 
141
  button_clicked = st.button("์ƒ๋‹จ์˜ ๏ฟฝ๏ฟฝ๏ฟฝ ์‚ฌ์ง„์„ ๋”ฅํŽ˜์ดํฌ ๋ชจ๋ธ์— ํ•™์Šต์‹œํ‚ค๊ธฐ")
142
  st.markdown('<p class="survey">์œ„ ์„œ๋น„์Šค๋ฅผ ์‚ฌ์šฉํ•ด ๋ณด์…จ๊ฑฐ๋‚˜, ์ €ํฌ ๊ธฐ์ˆ ์  ์›๋ฆฌ์— ๊ด€์‹ฌ์ด ์žˆ์œผ์‹  ๋ถ„๋“ค๊ป˜์„  ์•„๋ž˜์˜ ๊ฐ„๋‹จํ•œ ์ธํ„ฐ๋ทฐ์— ์ฐธ์—ฌํ•ด ์ฃผ์‹œ๋ฉด ์ง„์‹ฌ์œผ๋กœ ๊ฐ์‚ฌ๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค.</p>', unsafe_allow_html=True)
 
144
  st.markdown('<p class="survey-2">์„œ๋น„์Šค๋ฅผ ์ด์šฉํ•ด ์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค! ์ข‹์€ ํ•˜๋ฃจ ๋ณด๋‚ด์„ธ์š”!</p>', unsafe_allow_html=True)
145
 
146
  if button_clicked:
147
+ st.markdown('<div class="container">', unsafe_allow_html=True)
148
+
149
+ st.markdown('<div>', unsafe_allow_html=True)
150
+ processed_image = change_hair_to_blonde(image)
151
+ st.image(processed_image, use_column_width=True)
152
+ st.markdown('<div class="custom-caption-2">์›๋ณธ ์ด๋ฏธ์ง€๋ฅผ ๋”ฅํŽ˜์ดํฌ ๋ชจ๋ธ์— ๋„ฃ์—ˆ์„ ๊ฒฝ์šฐ</div>', unsafe_allow_html=True)
153
+ st.markdown("<span>์ดํ•ด๋ฅผ ๋•๊ธฐ ์œ„ํ•ด ์‚ฌ์ง„์— ๋…ธ๋ž€์ƒ‰์„ ์ž…ํžˆ๋Š” ๋”ฅํŽ˜์ดํฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์ ์šฉ. ์›๋ณธ ์ด๋ฏธ์ง€๋Š” ๋”ฅํŽ˜์ดํฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜์˜ ์˜ํ–ฅ์„ ๋ฐ›์Œ.</span>", unsafe_allow_html=True)
154
+ st.markdown('</div>', unsafe_allow_html=True)
155
 
156
+ st.markdown('<div>', unsafe_allow_html=True)
157
+ deepfake_image = add_noise(image)
158
+ st.image(deepfake_image, use_column_width=True)
159
+ st.markdown('<div class="custom-caption-2">์‚ฌ์ „ ๋ฐฉ์ง€ ํ•„ํ„ฐ ์ด๋ฏธ์ง€๋ฅผ ๋”ฅํŽ˜์ดํฌ ๋ชจ๋ธ์— ๋„ฃ์—ˆ์„ ๊ฒฝ์šฐ</div>', unsafe_allow_html=True)
160
+ st.markdown("<span>์‚ฌ์ „ ๋ฐฉ์ง€ ํ•„ํ„ฐ๋ฅผ ์ž…ํžŒ ์ด๋ฏธ์ง€๋Š” ๋”ฅํŽ˜์ดํฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜์˜ ์˜ํ–ฅ์„ ๋ฐ›์ง€ ์•Š๊ณ  ๋…ธ์ด์ฆˆ ์ฒ˜๋ฆฌ๊ฐ€ ๋˜์–ด ์•Œ์•„๋ณด๊ธฐ ํž˜๋“  ์‚ฌ์ง„์„ ์ถœ๋ ฅ. ์ฆ‰, ๋”ฅํŽ˜์ดํฌ ์‚ฌ์ง„ ํ•ฉ์„ฑ์„ ๋ฐฉํ•ดํ•จ.</span>", unsafe_allow_html=True)
161
+ st.markdown('</div>', unsafe_allow_html=True)
162
+
163
+ st.markdown('</div>', unsafe_allow_html=True)