Yuchan5386 commited on
Commit
f72b772
·
verified ·
1 Parent(s): d0d9378

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +149 -249
app.py CHANGED
@@ -24,282 +24,182 @@ def format_history(history):
24
  return html
25
 
26
  with gr.Blocks(css="""
27
-
28
  * {
29
- box-sizing: border-box;
30
- -webkit-tap-highlight-color: transparent;
31
- }
32
-
33
- body {
34
- margin: 0;
35
- padding: 0;
36
- font-family: 'Pretendard', 'Segoe UI', 'Apple SD Gothic Neo', sans-serif;
37
- background-color: #121212;
38
- color: #FFF;
39
- overflow-x: hidden;
40
- transition: background-color 0.3s ease;
41
- }
42
-
43
- /* 기본 레이아웃 */
44
- .gradio-container {
45
- background-color: #121212 !important;
46
- color: white;
47
- animation: fadeInUp 1.5s ease-out;
48
- }
49
-
50
- /* 제목 */
51
- h1 {
52
- text-align: center;
53
- font-size: 2.5rem;
54
- color: #00f7ff;
55
- margin: 40px 0;
56
- text-transform: uppercase;
57
- letter-spacing: 2px;
58
- animation: glowingText 3s infinite alternate;
59
- }
60
-
61
- /* 채팅창 */
62
- .chat-wrapper {
63
- background-color: #1A1A1A;
64
- border-radius: 20px;
65
- padding: 30px 35px;
66
- max-width: 768px;
67
- margin: auto;
68
- box-shadow: 0 0 20px rgba(0,0,0,0.3);
69
- height: 75vh;
70
- display: flex;
71
- flex-direction: column;
72
- justify-content: space-between;
73
- transition: background-color 0.3s ease, box-shadow 0.3s ease;
74
- }
75
-
76
- .chat-wrapper:hover {
77
- box-shadow: 0 0 30px rgba(0,0,0,0.5);
78
- }
79
-
80
- /* 스크롤바 스타일 */
81
- .chat-container {
82
- overflow-y: auto;
83
- flex-grow: 1;
84
- padding-right: 10px;
85
- margin-bottom: 30px;
86
- scrollbar-width: thin;
87
- scrollbar-color: #444 #1A1A1A;
88
- }
89
-
90
- .chat-container::-webkit-scrollbar {
91
- width: 6px;
92
- }
93
-
94
- .chat-container::-webkit-scrollbar-thumb {
95
- background-color: #444;
96
- border-radius: 3px;
97
- }
98
-
99
- /* 메시지 */
100
- .message {
101
- margin-bottom: 14px;
102
- display: flex;
103
- animation: slideIn 0.3s ease-in-out;
104
- gap: 10px;
105
- }
106
-
107
- .user {
108
- justify-content: flex-end;
109
- }
110
-
111
- .bot {
112
- justify-content: flex-start;
113
- }
114
-
115
- .bubble {
116
- max-width: 80%;
117
- padding: 14px 18px;
118
- border-radius: 18px;
119
- line-height: 1.6;
120
- font-size: 1rem;
121
- position: relative;
122
- animation: fadeIn 0.5s ease-in-out;
123
- word-break: break-word;
124
- white-space: pre-wrap;
125
- transition: background-color 0.3s ease, box-shadow 0.3s ease;
126
- }
127
-
128
- .user-bubble {
129
- background-color: #00796B;
130
- color: white;
131
- border-bottom-right-radius: 0;
132
- align-self: flex-end;
133
- box-shadow: 0 4px 8px rgba(0, 121, 107, 0.3);
134
- }
135
-
136
- .bot-bubble {
137
- background-color: #2F3136;
138
- color: white;
139
- border-bottom-left-radius: 0;
140
- align-self: flex-start;
141
- box-shadow: 0 4px 8px rgba(255, 255, 255, 0.1);
142
- }
143
-
144
- .bot-bubble:after {
145
- content: '';
146
- position: absolute;
147
- left: -10px;
148
- top: 10px;
149
- border: 6px solid transparent;
150
- border-right-color: #2F3136;
151
- }
152
-
153
- .user-bubble:after {
154
- content: '';
155
- position: absolute;
156
- right: -10px;
157
- top: 10px;
158
- border: 6px solid transparent;
159
- border-left-color: #00796B;
160
- }
161
-
162
- /* 메시지 입력 박스 */
163
- textarea, input[type="text"] {
164
- background-color: #2C2C2C !important;
165
- color: white !important;
166
- border: 1px solid #555 !important;
167
- border-radius: 14px !important;
168
- padding: 12px 14px !important;
169
- font-size: 1rem;
170
- width: 100%;
171
- transition: all 0.2s ease-in-out;
172
- }
173
-
174
- textarea:focus, input[type="text"]:focus {
175
- outline: none;
176
- border-color: #00f7ff !important;
177
- box-shadow: 0 0 5px #00f7ff55;
178
- }
179
 
180
- /* 버튼 스타일 */
181
- button {
182
- background-color: #00C896 !important;
183
- color: white !important;
184
- font-weight: bold;
185
- border: none !important;
186
- border-radius: 14px !important;
187
- padding: 12px 18px !important;
188
- font-size: 1rem;
189
- transition: all 0.2s ease-in-out;
190
- }
191
 
192
- button:hover {
193
- background-color: #00a67e !important;
194
- transform: scale(1.05);
195
- }
 
 
 
 
196
 
197
- /* 미디어 쿼리 */
198
- @media screen and (max-width: 1024px) {
199
  .chat-wrapper {
200
- padding: 20px 25px;
 
 
 
 
 
 
 
 
 
201
  }
202
- .message {
203
- gap: 12px;
 
 
 
 
 
 
204
  }
205
- }
206
 
207
- @media screen and (max-width: 768px) {
208
- .chat-wrapper {
209
- padding: 15px 20px;
210
- border-radius: 0;
211
  }
 
 
 
 
 
 
212
  .message {
213
- gap: 8px;
 
 
214
  }
215
- }
216
 
217
- /* 애니메이션 */
218
- @keyframes slideIn {
219
- 0% { transform: translateY(10px); opacity: 0; }
220
- 100% { transform: translateY(0); opacity: 1; }
221
- }
222
 
223
- @keyframes fadeIn {
224
- 0% { opacity: 0; }
225
- 100% { opacity: 1; }
226
- }
227
 
228
- @keyframes fadeInUp {
229
- 0% { transform: translateY(10px); opacity: 0; }
230
- 100% { transform: translateY(0); opacity: 1; }
231
- }
 
 
 
 
 
 
 
 
232
 
233
- @keyframes glowingText {
234
- 0% {
235
- text-shadow: 0 0 5px #00f7ff, 0 0 10px #00f7ff, 0 0 15px #00f7ff;
 
236
  }
237
- 50% {
238
- text-shadow: 0 0 10px #00f7ff, 0 0 20px #00f7ff, 0 0 30px #00f7ff;
 
 
 
239
  }
240
- 100% {
241
- text-shadow: 0 0 5px #00f7ff, 0 0 10px #00f7ff, 0 0 15px #00f7ff;
 
 
 
 
 
 
242
  }
243
- }
244
 
245
- /* 하이라이트 텍스트 */
246
- ::selection {
247
- background: #00f7ff;
248
- color: #000;
249
- }
 
 
 
250
 
251
- /* 스타일 조정: 메시지에 마우스를 올렸을 때 */
252
- .user-bubble:hover {
253
- background-color: #004d40;
254
- transform: scale(1.05);
255
- }
256
 
257
- .bot-bubble:hover {
258
- background-color: #1a1a1a;
259
- transform: scale(1.05);
260
- }
 
 
 
 
 
 
261
 
262
- .gradio-textbox input, .gradio-textbox textarea {
263
- background-color: #2C2C2C;
264
- color: white;
265
- border-radius: 14px;
266
- padding: 12px 16px;
267
- border: 1px solid #444;
268
- }
269
 
270
- .gradio-textbox input:focus, .gradio-textbox textarea:focus {
271
- border-color: #00f7ff;
272
- outline: none;
273
- box-shadow: 0 0 5px rgba(0, 247, 255, 0.5);
274
- }
 
 
 
 
 
 
275
 
276
- .gradio-button {
277
- background-color: #00C896;
278
- color: white;
279
- padding: 12px 18px;
280
- border-radius: 14px;
281
- font-size: 1rem;
282
- transition: all 0.2s ease;
283
- }
284
 
285
- .gradio-button:hover {
286
- background-color: #00a67e;
287
- transform: scale(1.05);
288
- }
 
 
 
 
289
 
290
- /* 최종 정리 */
291
- .chat-wrapper {
292
- animation: fadeInUp 1.5s ease-out;
293
- }
294
 
295
- .chat-container {
296
- padding-bottom: 20px;
297
- }
 
 
 
 
 
298
 
299
- button:active {
300
- transform: scale(0.95);
301
- }
302
-
303
  """) as demo:
304
 
305
  gr.HTML("<h1>Kossistant 챗봇</h1>")
@@ -315,4 +215,4 @@ button:active {
315
  send_button.click(chat_respond, inputs=[msg, state], outputs=[chatbox, state, msg])
316
  msg.submit(chat_respond, inputs=[msg, state], outputs=[chatbox, state, msg])
317
 
318
- demo.launch(share=True)
 
24
  return html
25
 
26
  with gr.Blocks(css="""
 
27
  * {
28
+ box-sizing: border-box;
29
+ margin: 0;
30
+ padding: 0;
31
+ transition: all 0.3s ease;
32
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
+ body {
35
+ background-color: #121212;
36
+ color: #ffffff;
37
+ font-family: 'Roboto', sans-serif;
38
+ overflow: hidden;
39
+ }
 
 
 
 
 
40
 
41
+ h1 {
42
+ font-size: 2.5rem;
43
+ color: #00f7ff;
44
+ text-align: center;
45
+ margin-top: 30px;
46
+ text-transform: uppercase;
47
+ letter-spacing: 2px;
48
+ }
49
 
 
 
50
  .chat-wrapper {
51
+ background-color: #1a1a1a;
52
+ border-radius: 20px;
53
+ padding: 40px;
54
+ max-width: 800px;
55
+ margin: auto;
56
+ box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
57
+ height: 80vh;
58
+ display: flex;
59
+ flex-direction: column;
60
+ justify-content: space-between;
61
  }
62
+
63
+ .chat-container {
64
+ overflow-y: auto;
65
+ flex-grow: 1;
66
+ padding-right: 15px;
67
+ margin-bottom: 30px;
68
+ scrollbar-width: thin;
69
+ scrollbar-color: #444 #1a1a1a;
70
  }
 
71
 
72
+ .chat-container::-webkit-scrollbar {
73
+ width: 8px;
 
 
74
  }
75
+
76
+ .chat-container::-webkit-scrollbar-thumb {
77
+ background-color: #444;
78
+ border-radius: 4px;
79
+ }
80
+
81
  .message {
82
+ display: flex;
83
+ margin-bottom: 20px;
84
+ animation: slideIn 0.4s ease-in-out;
85
  }
 
86
 
87
+ .user {
88
+ justify-content: flex-end;
89
+ }
 
 
90
 
91
+ .bot {
92
+ justify-content: flex-start;
93
+ }
 
94
 
95
+ .bubble {
96
+ max-width: 75%;
97
+ padding: 12px 16px;
98
+ border-radius: 20px;
99
+ font-size: 1.1rem;
100
+ line-height: 1.6;
101
+ word-break: break-word;
102
+ white-space: pre-wrap;
103
+ position: relative;
104
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
105
+ transition: all 0.3s ease;
106
+ }
107
 
108
+ .user-bubble {
109
+ background-color: #00796B;
110
+ color: white;
111
+ border-bottom-right-radius: 0;
112
  }
113
+
114
+ .bot-bubble {
115
+ background-color: #2F3136;
116
+ color: white;
117
+ border-bottom-left-radius: 0;
118
  }
119
+
120
+ .bot-bubble::after {
121
+ content: '';
122
+ position: absolute;
123
+ left: -8px;
124
+ top: 10px;
125
+ border: 6px solid transparent;
126
+ border-right-color: #2F3136;
127
  }
 
128
 
129
+ .user-bubble::after {
130
+ content: '';
131
+ position: absolute;
132
+ right: -8px;
133
+ top: 10px;
134
+ border: 6px solid transparent;
135
+ border-left-color: #00796B;
136
+ }
137
 
138
+ .bubble:hover {
139
+ transform: scale(1.05);
140
+ }
 
 
141
 
142
+ textarea, input[type="text"] {
143
+ background-color: #2C2C2C;
144
+ color: white;
145
+ border: 1px solid #555;
146
+ border-radius: 14px;
147
+ padding: 12px 14px;
148
+ font-size: 1rem;
149
+ width: 100%;
150
+ margin-top: 10px;
151
+ }
152
 
153
+ textarea:focus, input[type="text"]:focus {
154
+ outline: none;
155
+ border-color: #00f7ff;
156
+ box-shadow: 0 0 5px #00f7ff55;
157
+ }
 
 
158
 
159
+ button {
160
+ background-color: #00C896;
161
+ color: white;
162
+ font-weight: bold;
163
+ border: none;
164
+ border-radius: 14px;
165
+ padding: 14px 20px;
166
+ font-size: 1.1rem;
167
+ margin-top: 10px;
168
+ transition: all 0.2s ease;
169
+ }
170
 
171
+ button:hover {
172
+ background-color: #00a67e;
173
+ transform: scale(1.05);
174
+ }
 
 
 
 
175
 
176
+ .gradio-button {
177
+ background-color: #00C896;
178
+ color: white;
179
+ padding: 12px 18px;
180
+ border-radius: 14px;
181
+ font-size: 1rem;
182
+ transition: all 0.2s ease;
183
+ }
184
 
185
+ .gradio-button:hover {
186
+ background-color: #00a67e;
187
+ transform: scale(1.05);
188
+ }
189
 
190
+ @media screen and (max-width: 768px) {
191
+ .chat-wrapper {
192
+ padding: 20px;
193
+ }
194
+ h1 {
195
+ font-size: 2rem;
196
+ }
197
+ }
198
 
199
+ @keyframes slideIn {
200
+ 0% { transform: translateY(20px); opacity: 0; }
201
+ 100% { transform: translateY(0); opacity: 1; }
202
+ }
203
  """) as demo:
204
 
205
  gr.HTML("<h1>Kossistant 챗봇</h1>")
 
215
  send_button.click(chat_respond, inputs=[msg, state], outputs=[chatbox, state, msg])
216
  msg.submit(chat_respond, inputs=[msg, state], outputs=[chatbox, state, msg])
217
 
218
+ demo.launch(share=True)