Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -24,282 +24,182 @@ def format_history(history):
|
|
24 |
return html
|
25 |
|
26 |
with gr.Blocks(css="""
|
27 |
-
|
28 |
* {
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
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 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
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 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
|
|
|
|
|
|
|
|
196 |
|
197 |
-
/* 미디어 쿼리 */
|
198 |
-
@media screen and (max-width: 1024px) {
|
199 |
.chat-wrapper {
|
200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
}
|
202 |
-
|
203 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
}
|
205 |
-
}
|
206 |
|
207 |
-
|
208 |
-
|
209 |
-
padding: 15px 20px;
|
210 |
-
border-radius: 0;
|
211 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
.message {
|
213 |
-
|
|
|
|
|
214 |
}
|
215 |
-
}
|
216 |
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
100% { transform: translateY(0); opacity: 1; }
|
221 |
-
}
|
222 |
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
}
|
227 |
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
|
233 |
-
|
234 |
-
|
235 |
-
|
|
|
236 |
}
|
237 |
-
|
238 |
-
|
|
|
|
|
|
|
239 |
}
|
240 |
-
|
241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
}
|
243 |
-
}
|
244 |
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
|
|
|
|
|
|
250 |
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
transform: scale(1.05);
|
255 |
-
}
|
256 |
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
border: 1px solid #444;
|
268 |
-
}
|
269 |
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
border-radius: 14px;
|
281 |
-
font-size: 1rem;
|
282 |
-
transition: all 0.2s ease;
|
283 |
-
}
|
284 |
|
285 |
-
.gradio-button
|
286 |
-
|
287 |
-
|
288 |
-
|
|
|
|
|
|
|
|
|
289 |
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
}
|
294 |
|
295 |
-
|
296 |
-
|
297 |
-
|
|
|
|
|
|
|
|
|
|
|
298 |
|
299 |
-
|
300 |
-
|
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)
|