ssboost commited on
Commit
d63375e
Β·
verified Β·
1 Parent(s): 4767cdb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +158 -18
app.py CHANGED
@@ -140,29 +140,169 @@ class KyungAhNeChatbot:
140
  try:
141
  chatbot = KyungAhNeChatbot()
142
 
143
- # κ·ΈλΌλ””μ˜€ μΈν„°νŽ˜μ΄μŠ€
144
- demo = gr.ChatInterface(
145
- fn=chatbot.chat_stream,
146
- title="πŸ₯’ κ²½μ•„λ„€ AI 상담봇",
147
- description="μ œλ―Έλ‚˜μ΄ 2.0 기반 κ²½μ•„λ„€ λ°˜μ°¬κ°€κ²Œ 고객 μƒλ‹΄λ΄‡μž…λ‹ˆλ‹€. κΆκΈˆν•œ 것을 λ¬Όμ–΄λ³΄μ„Έμš”!",
148
- examples=[
149
- "주문은 μ–΄λ–»κ²Œ ν•˜λ‚˜μš”?",
150
- "ν¬μΈνŠΈλŠ” μ–΄λ–»κ²Œ μ‚¬μš©ν•˜λ‚˜μš”?",
151
- "배솑비가 μ–Όλ§ˆμΈκ°€μš”?",
152
- "ν™˜λΆˆ 방법을 μ•Œλ €μ£Όμ„Έμš”",
153
- "정기식 ꡬ성이 μ–΄λ–»κ²Œ λ˜λ‚˜μš”?",
154
- "ν›„κΈ° μ“°λ©΄ ν˜œνƒμ΄ μžˆλ‚˜μš”?",
155
- "반찬이 μƒν•œ 것 κ°™μ•„μš”",
156
- "원산지λ₯Ό μ•Œκ³  μ‹Άμ–΄μš”"
157
- ],
158
- theme=gr.themes.Soft(),
 
 
 
 
 
 
 
 
 
 
 
 
159
  css="""
 
160
  .gradio-container {
161
- max-width: 800px !important;
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):