Update app.py
Browse files
app.py
CHANGED
|
@@ -140,29 +140,169 @@ class KyungAhNeChatbot:
|
|
| 140 |
try:
|
| 141 |
chatbot = KyungAhNeChatbot()
|
| 142 |
|
| 143 |
-
#
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
"
|
| 150 |
-
"
|
| 151 |
-
"
|
| 152 |
-
"
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
css="""
|
|
|
|
| 160 |
.gradio-container {
|
| 161 |
-
max-width:
|
| 162 |
margin: auto !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
}
|
| 164 |
"""
|
| 165 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
|
| 167 |
except Exception as e:
|
| 168 |
def error_message(message, history):
|
|
|
|
| 140 |
try:
|
| 141 |
chatbot = KyungAhNeChatbot()
|
| 142 |
|
| 143 |
+
# 컀μ€ν
ν€λ HTML
|
| 144 |
+
header_html = """
|
| 145 |
+
<div class="header-container">
|
| 146 |
+
<h1 class="main-title">π₯’ κ²½μλ€ AI μλ΄λ΄</h1>
|
| 147 |
+
<p class="sub-title">μ λ―Έλμ΄ 2.0 κΈ°λ° μ€λ§νΈ κ³ κ°μλ΄ μμ€ν
</p>
|
| 148 |
+
<div class="info-cards">
|
| 149 |
+
<div class="info-card">π 010-8082-0047</div>
|
| 150 |
+
<div class="info-card">π¦ νλμν 12345-00-1234304</div>
|
| 151 |
+
<div class="info-card">π° μ΅μμ£Όλ¬Έ 26,000μ</div>
|
| 152 |
+
<div class="info-card">π μλ²½λ°°μ‘ 3,500μ</div>
|
| 153 |
+
</div>
|
| 154 |
+
</div>
|
| 155 |
+
"""
|
| 156 |
+
|
| 157 |
+
# κ·ΈλΌλμ€ μΈν°νμ΄μ€ μμ±
|
| 158 |
+
with gr.Blocks(
|
| 159 |
+
theme=gr.themes.Base(
|
| 160 |
+
primary_hue="green",
|
| 161 |
+
secondary_hue="blue",
|
| 162 |
+
neutral_hue="slate",
|
| 163 |
+
font=gr.themes.GoogleFont("Noto Sans KR"),
|
| 164 |
+
).set(
|
| 165 |
+
body_background_fill="linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
|
| 166 |
+
block_background_fill="rgba(255, 255, 255, 0.95)",
|
| 167 |
+
block_border_width="0px",
|
| 168 |
+
block_radius="16px",
|
| 169 |
+
block_shadow="0 8px 32px rgba(0, 0, 0, 0.1)",
|
| 170 |
+
),
|
| 171 |
css="""
|
| 172 |
+
/* μ 체 컨ν
μ΄λ μ€νμΌ */
|
| 173 |
.gradio-container {
|
| 174 |
+
max-width: 1000px !important;
|
| 175 |
margin: auto !important;
|
| 176 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 177 |
+
min-height: 100vh;
|
| 178 |
+
padding: 20px;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
/* ν€λ μμ */
|
| 182 |
+
.header-container {
|
| 183 |
+
background: rgba(255, 255, 255, 0.95);
|
| 184 |
+
border-radius: 20px;
|
| 185 |
+
padding: 30px;
|
| 186 |
+
margin-bottom: 20px;
|
| 187 |
+
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
|
| 188 |
+
backdrop-filter: blur(20px);
|
| 189 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
/* λ©μΈ νμ΄ν */
|
| 193 |
+
.main-title {
|
| 194 |
+
font-size: 2.5rem;
|
| 195 |
+
font-weight: 700;
|
| 196 |
+
background: linear-gradient(45deg, #FF6B6B, #4ECDC4);
|
| 197 |
+
-webkit-background-clip: text;
|
| 198 |
+
-webkit-text-fill-color: transparent;
|
| 199 |
+
text-align: center;
|
| 200 |
+
margin-bottom: 10px;
|
| 201 |
+
font-family: 'Noto Sans KR', sans-serif;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
/* μλΈνμ΄ν */
|
| 205 |
+
.sub-title {
|
| 206 |
+
font-size: 1.1rem;
|
| 207 |
+
color: #666;
|
| 208 |
+
text-align: center;
|
| 209 |
+
margin-bottom: 20px;
|
| 210 |
+
font-family: 'Noto Sans KR', sans-serif;
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
/* μ 보 μΉ΄λλ€ */
|
| 214 |
+
.info-cards {
|
| 215 |
+
display: grid;
|
| 216 |
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
| 217 |
+
gap: 15px;
|
| 218 |
+
margin-top: 20px;
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
.info-card {
|
| 222 |
+
background: linear-gradient(45deg, #FF9A9E, #FECFEF);
|
| 223 |
+
padding: 15px;
|
| 224 |
+
border-radius: 12px;
|
| 225 |
+
text-align: center;
|
| 226 |
+
color: white;
|
| 227 |
+
font-weight: 600;
|
| 228 |
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
|
| 229 |
+
transition: transform 0.3s ease;
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
.info-card:hover {
|
| 233 |
+
transform: translateY(-5px);
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
/* μ±ν
μμ */
|
| 237 |
+
.chatbot {
|
| 238 |
+
background: rgba(255, 255, 255, 0.95) !important;
|
| 239 |
+
border-radius: 20px !important;
|
| 240 |
+
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1) !important;
|
| 241 |
+
backdrop-filter: blur(20px) !important;
|
| 242 |
+
border: 1px solid rgba(255, 255, 255, 0.2) !important;
|
| 243 |
+
min-height: 500px !important;
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
/* μ
λ ₯ μμ */
|
| 247 |
+
.input-container textarea {
|
| 248 |
+
background: rgba(255, 255, 255, 0.9) !important;
|
| 249 |
+
border-radius: 15px !important;
|
| 250 |
+
border: 2px solid #4ECDC4 !important;
|
| 251 |
+
padding: 12px !important;
|
| 252 |
+
font-family: 'Noto Sans KR', sans-serif !important;
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
/* μ μ‘ λ²νΌ */
|
| 256 |
+
button {
|
| 257 |
+
background: linear-gradient(45deg, #FF6B6B, #4ECDC4) !important;
|
| 258 |
+
border: none !important;
|
| 259 |
+
border-radius: 12px !important;
|
| 260 |
+
color: white !important;
|
| 261 |
+
font-weight: 600 !important;
|
| 262 |
+
padding: 10px 20px !important;
|
| 263 |
+
transition: all 0.3s ease !important;
|
| 264 |
+
font-family: 'Noto Sans KR', sans-serif !important;
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
button:hover {
|
| 268 |
+
transform: translateY(-2px) !important;
|
| 269 |
+
box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4) !important;
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
/* λͺ¨λ°μΌ λ°μν */
|
| 273 |
+
@media (max-width: 768px) {
|
| 274 |
+
.gradio-container {
|
| 275 |
+
padding: 10px;
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
.main-title {
|
| 279 |
+
font-size: 2rem;
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
.info-cards {
|
| 283 |
+
grid-template-columns: 1fr 1fr;
|
| 284 |
+
}
|
| 285 |
}
|
| 286 |
"""
|
| 287 |
+
) as demo:
|
| 288 |
+
|
| 289 |
+
# ν€λ νμ
|
| 290 |
+
gr.HTML(header_html)
|
| 291 |
+
|
| 292 |
+
# μ±ν
μΈν°νμ΄μ€
|
| 293 |
+
gr.ChatInterface(
|
| 294 |
+
fn=chatbot.chat_stream,
|
| 295 |
+
examples=[
|
| 296 |
+
"μ£Όλ¬Έμ μ΄λ»κ² νλμ?",
|
| 297 |
+
"ν¬μΈνΈλ μ΄λ»κ² μ¬μ©νλμ?",
|
| 298 |
+
"λ°°μ‘λΉκ° μΌλ§μΈκ°μ?",
|
| 299 |
+
"νλΆ λ°©λ²μ μλ €μ£ΌμΈμ",
|
| 300 |
+
"μ κΈ°μ ꡬμ±μ΄ μ΄λ»κ² λλμ?",
|
| 301 |
+
"νκΈ° μ°λ©΄ ννμ΄ μλμ?",
|
| 302 |
+
"λ°μ°¬μ΄ μν κ² κ°μμ",
|
| 303 |
+
"μμ°μ§λ₯Ό μκ³ μΆμ΄μ"
|
| 304 |
+
]
|
| 305 |
+
)
|
| 306 |
|
| 307 |
except Exception as e:
|
| 308 |
def error_message(message, history):
|