minhwai commited on
Commit
f8f00d1
Β·
verified Β·
1 Parent(s): 03db935

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -22
app.py CHANGED
@@ -7,6 +7,7 @@ from PIL import Image, ExifTags
7
  # κ°€μž₯ λ¨Όμ € set_page_config() 호좜
8
  st.set_page_config(page_title="λ”₯페이크 사전 λ°©μ§€ ν•„ν„°(ν…ŒμŠ€νŠΈ)", layout="wide")
9
 
 
10
  ga_code = """
11
  <!-- Global site tag (gtag.js) - Google Analytics -->
12
  <script async src="https://www.googletagmanager.com/gtag/js?id=G-PZPBGNENQG"></script>
@@ -21,14 +22,34 @@ ga_code = """
21
  # Streamlit에 GA μ½”λ“œ μ‚½μž…
22
  components.html(ga_code, height=0)
23
 
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 {
@@ -50,7 +71,7 @@ css = """
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;
@@ -90,14 +111,14 @@ css = """
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;
@@ -165,21 +186,9 @@ css = """
165
  }
166
  }
167
  </style>
168
- """
169
-
170
- # CSSλ₯Ό HTML둜 μ‚½μž…
171
- st.markdown(css, unsafe_allow_html=True)
172
-
173
- st.title("λ”₯페이크 사전 λ°©μ§€ ν•„ν„°(ν…ŒμŠ€νŠΈ)")
174
- st.markdown("")
175
- st.markdown("<span style='font-size: 18px;'>μ•ˆλ…•ν•˜μ„Έμš”! μ €ν¬λŠ” λ”₯νŽ˜μ΄ν¬λ‘œλΆ€ν„° μ—¬λŸ¬λΆ„μ˜ 사진을 λ³΄ν˜Έν•˜λŠ” μ†”λ£¨μ…˜μ„ κ°œλ°œν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.</span>", unsafe_allow_html=True)
176
- st.markdown("<span style='font-size: 18px;'>μ €ν¬μ˜ λͺ©ν‘œλŠ” μ˜¨λΌμΈμ— κ²Œμ‹œλœ 개인의 사진이 μ•…μ„± λ”₯페이크 μ˜μƒμ— μ‚¬μš©λ˜μ§€ μ•Šλ„λ‘ ν•˜λŠ” κ²ƒμž…λ‹ˆλ‹€. ν˜„μž¬λŠ” κ°œλ°œμ„ λ§ˆλ¬΄λ¦¬ν•˜κ³  μ„œλΉ„μŠ€ν™” ν•˜κΈ° μ „, μ—¬λŸ¬λΆ„μ˜ μ˜κ²¬μ„ λ“£κΈ° μœ„ν•΄ κ°„λ‹¨ν•œ ν…ŒμŠ€νŠΈλ₯Ό μ§„ν–‰ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.</span>", unsafe_allow_html=True)
177
- st.markdown("<span style='font-size: 18px;'>졜근 SNS에 μ—…λ‘œλ“œλœ 이미지가 λ”₯페이크 포λ₯΄λ…Έλ¬Όμ— μ•…μš©λ˜λŠ” 사둀가 맀일 보고되고 μžˆμŠ΅λ‹ˆλ‹€. λ”°λΌμ„œ 해결책을 κ°•κ΅¬ν•˜κΈ° μœ„ν•΄, μ—¬λŸ¬λΆ„μ˜ μ†Œμ€‘ν•œ 의견이 ν•„μš”ν•©λ‹ˆλ‹€.</span>", unsafe_allow_html=True)
178
- st.markdown("<span style='font-size: 18px;'>μ•„λž˜ 링크λ₯Ό 톡해 저희 μ„œλΉ„μŠ€λ₯Ό μ΄μš©ν•΄ 보신 ν›„, 인터뷰에 μ°Έμ—¬ν•΄ μ£Όμ‹œλ©΄ 큰 도움이 λ˜κ² μŠ΅λ‹ˆλ‹€. μ—¬λŸ¬λΆ„μ˜ ν”Όλ“œλ°±μ€ μ„œλΉ„μŠ€ κ°œμ„ μ— κ·€μ€‘ν•œ μžλ£Œκ°€ 될 κ²ƒμž…λ‹ˆλ‹€.</span>", unsafe_allow_html=True)
179
- st.markdown("")
180
- st.markdown("<span style='font-size: 18px;'>λ™μž‘ 원리 : 1. 이미지λ₯Ό μ—…λ‘œλ“œν•˜λ©΄, 사전 λ°©μ§€ ν•„ν„°κ°€ 적용된 이미지λ₯Ό οΏ½οΏ½οΏ½μ—¬λ“œλ¦½λ‹ˆλ‹€. 2. ν•˜λ‹¨μ˜ 흰 λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ λ”₯페이크 λͺ¨λΈμ„ 톡해 μƒμ„±λœ κ²°κ³Όλ₯Ό 확인할 수 μžˆμŠ΅λ‹ˆλ‹€.</span>", unsafe_allow_html=True)
181
- st.markdown("<span style='font-size: 18px;'>μ—¬λŸ¬λΆ„μ˜ 참여에 κ°μ‚¬λ“œλ¦½λ‹ˆλ‹€!</span>", unsafe_allow_html=True)
182
- st.markdown("<span style='font-size: 14px;'> *사전 λ°©μ§€ ν•„ν„°λž€: μ—¬λŸ¬λΆ„μ˜ 사진이 λ”₯페이크 λͺ¨λΈμ— ν•™μŠ΅λ˜μ§€ λͺ»ν•˜λ„둝 λ°©ν•΄ν•˜λŠ” λ…Έμ΄μ¦ˆ(noise)ν˜•νƒœμ˜ ν•„ν„°.</span>", unsafe_allow_html=True)
183
 
184
  def change_hair_to_blonde(image):
185
  # Convert to OpenCV format
 
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>
 
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
  /* 곡톡 μŠ€νƒ€μΌ */
41
  .stFileUploader label,
42
  .stRadio label,
43
+ .stRadio div,
44
+ .custom-caption-1,
45
+ .custom-caption-2,
46
+ .button-container,
47
  .stButton button,
48
+ .survey,
49
+ .survey-1,
50
+ .survey-2,
51
+ .a-tag,
52
+ a {
53
  transition: all 0.3s ease;
54
  }
55
  .stFileUploader label {
 
71
  font-weight: bold;
72
  text-align: center;
73
  margin-top: 10px;
74
+ padding: 0 0 200px 0;
75
  }
76
  .custom-caption-2 {
77
  font-size: 36px;
 
111
  .survey-1 {
112
  font-size: 25px;
113
  text-align: center;
114
+ margin-top: 10px
115
  font-weight: bold;
116
  }
117
  .survey-2 {
118
  text-align: center;
119
+ margin-top: 10px
120
  font-weight: bold;
121
+ padding 0 auto 50px auto
122
  }
123
  .a-tag {
124
  color: #FF0080;
 
186
  }
187
  }
188
  </style>
189
+ """,
190
+ unsafe_allow_html=True,
191
+ )
 
 
 
 
 
 
 
 
 
 
 
 
192
 
193
  def change_hair_to_blonde(image):
194
  # Convert to OpenCV format