Kim Juwon commited on
Commit
9b89e2b
Β·
1 Parent(s): 4cee86c

update UI/UX

Browse files
Files changed (1) hide show
  1. app.py +131 -20
app.py CHANGED
@@ -88,22 +88,128 @@ For information on how to customize the ChatInterface, peruse the gradio docs: h
88
  custom_css = """
89
  .gradio-container {
90
  font-family: 'Helvetica Neue', Arial, sans-serif;
 
 
 
91
  }
 
92
  .container {
93
  max-width: 800px;
94
  margin: auto;
95
  padding: 20px;
96
  }
 
 
 
 
 
 
 
 
 
 
 
 
97
  .chat-message {
98
- padding: 15px;
 
99
  border-radius: 10px;
100
- margin-bottom: 10px;
 
 
 
101
  }
 
 
 
 
 
 
 
102
  .user-message {
103
  background-color: #f0f2f5;
 
 
104
  }
 
 
105
  .bot-message {
106
  background-color: #e3f2fd;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  }
108
  """
109
 
@@ -117,23 +223,27 @@ with gr.Blocks(css=custom_css) as demo:
117
 
118
  with gr.Row():
119
  with gr.Column(scale=2):
120
- chatbot = gr.Chatbot(
121
- height=600,
122
- show_copy_button=True,
123
- avatar_images=("πŸ‘€", "🎬"),
124
- bubble_full_width=False,
125
- )
126
- msg = gr.Textbox(
127
- placeholder="μ–΄λ–€ μ˜ν™”λ₯Ό μ°Ύκ³  κ³„μ‹ κ°€μš”?",
128
- show_label=False,
129
- container=False
130
- )
131
- with gr.Row():
132
- submit = gr.Button("μΆ”μ²œ λ°›κΈ°", variant="primary")
133
- clear = gr.Button("λŒ€ν™” μ΄ˆκΈ°ν™”")
 
 
 
 
134
 
135
  with gr.Column(scale=1):
136
- with gr.Group():
137
  gr.Markdown("### 🎯 μΆ”μ²œ μ„€μ •")
138
  genre = gr.Dropdown(
139
  choices=["μ•‘μ…˜", "μ½”λ―Έλ””", "λ“œλΌλ§ˆ", "둜맨슀", "슀릴러", "SF", "νŒνƒ€μ§€", "μ• λ‹ˆλ©”μ΄μ…˜"],
@@ -146,7 +256,7 @@ with gr.Blocks(css=custom_css) as demo:
146
  multiselect=True
147
  )
148
 
149
- with gr.Group():
150
  gr.Markdown("### πŸ€– Agent μ„€μ •")
151
  agent_type = gr.Dropdown(
152
  choices=["μ „λ¬Έκ°€", "친ꡬ", "μ˜ν™” 평둠가", "νλ ˆμ΄ν„°"],
@@ -169,7 +279,7 @@ with gr.Blocks(css=custom_css) as demo:
169
  value="ν•œκ΅­μ–΄"
170
  )
171
 
172
- with gr.Group():
173
  gr.Markdown("### βš™οΈ κ³ κΈ‰ μ„€μ •")
174
  max_tokens = gr.Slider(
175
  minimum=1,
@@ -197,7 +307,8 @@ with gr.Blocks(css=custom_css) as demo:
197
  settings_modal = gr.Modal(
198
  title="섀정이 λ³€κ²½λ˜μ—ˆμŠ΅λ‹ˆλ‹€",
199
  visible=False,
200
- interactive=False
 
201
  )
202
 
203
  # μ„€μ • λ³€κ²½ μ‹œ μ±„νŒ… μ΄ˆκΈ°ν™” 및 Modal ν‘œμ‹œ
 
88
  custom_css = """
89
  .gradio-container {
90
  font-family: 'Helvetica Neue', Arial, sans-serif;
91
+ max-width: 1200px;
92
+ margin: auto;
93
+ padding: 20px;
94
  }
95
+
96
  .container {
97
  max-width: 800px;
98
  margin: auto;
99
  padding: 20px;
100
  }
101
+
102
+ /* μ±„νŒ… μ»¨ν…Œμ΄λ„ˆ μŠ€νƒ€μΌ */
103
+ .chat-container {
104
+ display: flex;
105
+ flex-direction: column;
106
+ height: 100%;
107
+ background: #ffffff;
108
+ border-radius: 10px;
109
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
110
+ }
111
+
112
+ /* μ±„νŒ… λ©”μ‹œμ§€ μŠ€νƒ€μΌ */
113
  .chat-message {
114
+ padding: 20px;
115
+ margin: 10px;
116
  border-radius: 10px;
117
+ max-width: 85%;
118
+ line-height: 1.5;
119
+ position: relative;
120
+ animation: fadeIn 0.3s ease-in-out;
121
  }
122
+
123
+ @keyframes fadeIn {
124
+ from { opacity: 0; transform: translateY(10px); }
125
+ to { opacity: 1; transform: translateY(0); }
126
+ }
127
+
128
+ /* μ‚¬μš©μž λ©”μ‹œμ§€ μŠ€νƒ€μΌ */
129
  .user-message {
130
  background-color: #f0f2f5;
131
+ margin-left: auto;
132
+ border-bottom-right-radius: 0;
133
  }
134
+
135
+ /* 봇 λ©”μ‹œμ§€ μŠ€νƒ€μΌ */
136
  .bot-message {
137
  background-color: #e3f2fd;
138
+ margin-right: auto;
139
+ border-bottom-left-radius: 0;
140
+ }
141
+
142
+ /* μž…λ ₯ μ˜μ—­ μŠ€νƒ€μΌ */
143
+ .input-container {
144
+ display: flex;
145
+ gap: 10px;
146
+ padding: 20px;
147
+ background: #ffffff;
148
+ border-top: 1px solid #e0e0e0;
149
+ position: sticky;
150
+ bottom: 0;
151
+ }
152
+
153
+ /* μž…λ ₯ ν•„λ“œ μŠ€νƒ€μΌ */
154
+ input[type="text"] {
155
+ flex: 1;
156
+ padding: 12px;
157
+ border: 1px solid #e0e0e0;
158
+ border-radius: 8px;
159
+ font-size: 16px;
160
+ transition: border-color 0.3s ease;
161
+ }
162
+
163
+ input[type="text"]:focus {
164
+ border-color: #2196f3;
165
+ outline: none;
166
+ }
167
+
168
+ /* λ²„νŠΌ μŠ€νƒ€μΌ */
169
+ button {
170
+ padding: 12px 24px;
171
+ border: none;
172
+ border-radius: 8px;
173
+ background-color: #2196f3;
174
+ color: white;
175
+ font-weight: 600;
176
+ cursor: pointer;
177
+ transition: background-color 0.3s ease;
178
+ }
179
+
180
+ button:hover {
181
+ background-color: #1976d2;
182
+ }
183
+
184
+ /* μ„€μ • νŒ¨λ„ μŠ€νƒ€μΌ */
185
+ .settings-panel {
186
+ background: #ffffff;
187
+ padding: 20px;
188
+ border-radius: 10px;
189
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
190
+ }
191
+
192
+ /* λ“œλ‘­λ‹€μš΄ μŠ€νƒ€μΌ */
193
+ select {
194
+ width: 100%;
195
+ padding: 8px;
196
+ border: 1px solid #e0e0e0;
197
+ border-radius: 6px;
198
+ margin-bottom: 10px;
199
+ }
200
+
201
+ /* μŠ¬λΌμ΄λ” μŠ€νƒ€μΌ */
202
+ input[type="range"] {
203
+ width: 100%;
204
+ margin: 10px 0;
205
+ }
206
+
207
+ /* λͺ¨λ‹¬ μŠ€νƒ€μΌ */
208
+ .modal {
209
+ background: #ffffff;
210
+ border-radius: 10px;
211
+ padding: 20px;
212
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
213
  }
214
  """
215
 
 
223
 
224
  with gr.Row():
225
  with gr.Column(scale=2):
226
+ with gr.Group(elem_classes="chat-container"):
227
+ chatbot = gr.Chatbot(
228
+ height=600,
229
+ show_copy_button=True,
230
+ avatar_images=("πŸ‘€", "🎬"),
231
+ bubble_full_width=False,
232
+ elem_classes=["chat-message"],
233
+ )
234
+ with gr.Group(elem_classes="input-container"):
235
+ msg = gr.Textbox(
236
+ placeholder="μ–΄λ–€ μ˜ν™”λ₯Ό μ°Ύκ³  κ³„μ‹ κ°€μš”?",
237
+ show_label=False,
238
+ container=False,
239
+ scale=8
240
+ )
241
+ with gr.Row(scale=2):
242
+ submit = gr.Button("μΆ”μ²œ λ°›κΈ°", variant="primary", size="sm")
243
+ clear = gr.Button("λŒ€ν™” μ΄ˆκΈ°ν™”", size="sm")
244
 
245
  with gr.Column(scale=1):
246
+ with gr.Group(elem_classes="settings-panel"):
247
  gr.Markdown("### 🎯 μΆ”μ²œ μ„€μ •")
248
  genre = gr.Dropdown(
249
  choices=["μ•‘μ…˜", "μ½”λ―Έλ””", "λ“œλΌλ§ˆ", "둜맨슀", "슀릴러", "SF", "νŒνƒ€μ§€", "μ• λ‹ˆλ©”μ΄μ…˜"],
 
256
  multiselect=True
257
  )
258
 
259
+ with gr.Group(elem_classes="settings-panel"):
260
  gr.Markdown("### πŸ€– Agent μ„€μ •")
261
  agent_type = gr.Dropdown(
262
  choices=["μ „λ¬Έκ°€", "친ꡬ", "μ˜ν™” 평둠가", "νλ ˆμ΄ν„°"],
 
279
  value="ν•œκ΅­μ–΄"
280
  )
281
 
282
+ with gr.Group(elem_classes="settings-panel"):
283
  gr.Markdown("### βš™οΈ κ³ κΈ‰ μ„€μ •")
284
  max_tokens = gr.Slider(
285
  minimum=1,
 
307
  settings_modal = gr.Modal(
308
  title="섀정이 λ³€κ²½λ˜μ—ˆμŠ΅λ‹ˆλ‹€",
309
  visible=False,
310
+ interactive=False,
311
+ elem_classes="modal"
312
  )
313
 
314
  # μ„€μ • λ³€κ²½ μ‹œ μ±„νŒ… μ΄ˆκΈ°ν™” 및 Modal ν‘œμ‹œ