Yuchan5386 commited on
Commit
7b47383
ยท
verified ยท
1 Parent(s): 33edad8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +264 -221
app.py CHANGED
@@ -24,239 +24,282 @@ def format_history(history):
24
  return html
25
 
26
  with gr.Blocks(css="""
 
27
  * {
28
- box-sizing: border-box;
29
- -webkit-tap-highlight-color: transparent;
30
- }
31
- body {
32
- margin: 0;
33
- padding: 0;
34
- font-family: 'Pretendard', 'Segoe UI', 'Apple SD Gothic Neo', sans-serif;
35
- background-color: #121212;
36
- color: #FFF;
37
- overflow-x: hidden;
38
- transition: background-color 0.3s ease;
39
- }
40
- .gradio-container {
41
- background-color: #121212 !important;
42
- color: white;
43
- }
44
- h1 {
45
- text-align: center;
46
- font-size: 2rem;
47
- color: #00f7ff;
48
- margin: 30px 0;
49
- text-transform: uppercase;
50
- letter-spacing: 1px;
51
- animation: fadeIn 1.5s ease-in-out;
52
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  .chat-wrapper {
54
- background-color: #1A1A1A;
55
- border-radius: 20px;
56
- padding: 30px 35px;
57
- max-width: 768px;
58
- margin: auto;
59
- box-shadow: 0 0 20px rgba(0,0,0,0.3);
60
- height: 75vh;
61
- display: flex;
62
- flex-direction: column;
63
- justify-content: space-between;
64
- transition: background-color 0.3s ease, box-shadow 0.3s ease;
65
- }
66
- .chat-wrapper:hover {
67
- box-shadow: 0 0 30px rgba(0,0,0,0.5);
68
- }
69
- .chat-container {
70
- overflow-y: auto;
71
- flex-grow: 1;
72
- padding-right: 10px;
73
- margin-bottom: 30px;
74
- scrollbar-width: thin;
75
- scrollbar-color: #444 #1A1A1A;
76
- }
77
- .chat-container::-webkit-scrollbar {
78
- width: 6px;
79
- }
80
- .chat-container::-webkit-scrollbar-thumb {
81
- background-color: #444;
82
- border-radius: 3px;
83
  }
84
  .message {
85
- margin-bottom: 14px;
86
- display: flex;
87
- animation: slideIn 0.3s ease-in-out;
88
- }
89
- .user {
90
- justify-content: flex-end;
91
- }
92
- .bot {
93
- justify-content: flex-start;
94
- }
95
- .bubble {
96
- max-width: 80%;
97
- padding: 12px 16px;
98
- border-radius: 20px;
99
- line-height: 1.6;
100
- font-size: 0.98rem;
101
- position: relative;
102
- animation: fadeIn 0.5s ease-in-out;
103
- word-break: break-word;
104
- white-space: pre-wrap;
105
- transition: background-color 0.3s ease, box-shadow 0.3s ease;
106
- }
107
- .user-bubble {
108
- background-color: #00796B;
109
- color: white;
110
- border-bottom-right-radius: 0;
111
- align-self: flex-end;
112
- box-shadow: 0 4px 8px rgba(0, 121, 107, 0.3);
113
  }
114
- .bot-bubble {
115
- background-color: #2F3136;
116
- color: white;
117
- border-bottom-left-radius: 0;
118
- align-self: flex-start;
119
- box-shadow: 0 4px 8px rgba(255, 255, 255, 0.1);
120
- }
121
- .bot-bubble:after {
122
- content: '';
123
- position: absolute;
124
- left: -10px;
125
- top: 10px;
126
- border: 6px solid transparent;
127
- border-right-color: #2F3136;
128
- }
129
- .user-bubble:after {
130
- content: '';
131
- position: absolute;
132
- right: -10px;
133
- top: 10px;
134
- border: 6px solid transparent;
135
- border-left-color: #00796B;
136
- }
137
- textarea, input[type="text"] {
138
- background-color: #2C2C2C !important;
139
- color: white !important;
140
- border: 1px solid #555 !important;
141
- border-radius: 14px !important;
142
- padding: 12px 14px !important;
143
- font-size: 1rem;
144
- width: 100%;
145
- transition: all 0.2s ease-in-out;
146
- }
147
- textarea:focus, input[type="text"]:focus {
148
- outline: none;
149
- border-color: #00f7ff !important;
150
- box-shadow: 0 0 5px #00f7ff55;
151
- }
152
- button {
153
- background-color: #00C896 !important;
154
- color: white !important;
155
- font-weight: bold;
156
- border: none !important;
157
- border-radius: 14px !important;
158
- padding: 12px 18px !important;
159
- font-size: 1rem;
160
- transition: all 0.2s ease-in-out;
161
- }
162
- button:hover {
163
- background-color: #00a67e !important;
164
- transform: scale(1.05);
165
- }
166
- @media screen and (max-width: 768px) {
167
- .chat-wrapper {
168
- padding: 16px;
169
- border-radius: 0;
170
- }
171
- .bubble {
172
- font-size: 0.95rem;
173
- }
174
- }
175
- ::selection {
176
- background: #00f7ff;
177
- color: #000;
178
- }
179
- @keyframes slideIn {
180
- 0% { transform: translateY(10px); opacity: 0; }
181
- 100% { transform: translateY(0); opacity: 1; }
182
- }
183
- @keyframes fadeIn {
184
- 0% { opacity: 0; }
185
- 100% { opacity: 1; }
186
  }
187
- /* ์ถ”๊ฐ€์ ์ธ ์š”์†Œ๋“ค */
188
  .message {
189
- display: flex;
190
- flex-direction: column;
191
  gap: 8px;
192
  }
193
- .user-bubble {
194
- background-color: #00796B;
195
- color: white;
196
- padding: 14px 18px;
197
- border-radius: 18px;
198
- box-shadow: 0 4px 6px rgba(0, 121, 107, 0.3);
199
- transition: all 0.3s ease-in-out;
200
- }
201
- .user-bubble:hover {
202
- background-color: #004d40;
203
- transform: scale(1.05);
204
- }
205
- .bot-bubble {
206
- background-color: #2F3136;
207
- color: white;
208
- padding: 14px 18px;
209
- border-radius: 18px;
210
- box-shadow: 0 4px 6px rgba(255, 255, 255, 0.1);
211
- transition: all 0.3s ease-in-out;
212
- }
213
- .bot-bubble:hover {
214
- background-color: #1a1a1a;
215
- transform: scale(1.05);
216
- }
217
- /* ๋ฉ”์‹œ์ง€ ์ž…๋ ฅ ์Šคํƒ€์ผ */
218
- .gradio-textbox input, .gradio-textbox textarea {
219
- background-color: #2C2C2C;
220
- color: white;
221
- border-radius: 14px;
222
- padding: 12px 16px;
223
- border: 1px solid #444;
224
- }
225
- .gradio-textbox input:focus, .gradio-textbox textarea:focus {
226
- border-color: #00f7ff;
227
- outline: none;
228
- box-shadow: 0 0 5px rgba(0, 247, 255, 0.5);
229
- }
230
- .gradio-button {
231
- background-color: #00C896;
232
- color: white;
233
- padding: 12px 18px;
234
- border-radius: 14px;
235
- font-size: 1rem;
236
- transition: all 0.2s ease;
237
- }
238
- .gradio-button:hover {
239
- background-color: #00a67e;
240
- transform: scale(1.05);
241
  }
242
- /* ๋ฏธ๋””์–ด ์ฟผ๋ฆฌ ๊ฐœ์„  */
243
- @media (max-width: 1024px) {
244
- .chat-wrapper {
245
- padding: 20px 25px;
246
- }
247
- .message {
248
- gap: 12px;
249
- }
250
  }
251
- @media (max-width: 768px) {
252
- .chat-wrapper {
253
- padding: 15px 20px;
254
- border-radius: 0;
255
- }
256
- .message {
257
- gap: 8px;
258
- }
259
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
  """) as demo:
261
 
262
  gr.HTML("<h1>Kossistant ์ฑ—๋ด‡</h1>")
 
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>")