Kim Juwon
commited on
Commit
Β·
64e473e
1
Parent(s):
ea24680
update UI/UX
Browse files
app.py
CHANGED
|
@@ -80,139 +80,7 @@ def show_settings_changed_info(agent_type, personality, expertise_level, languag
|
|
| 80 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 81 |
"""
|
| 82 |
|
| 83 |
-
|
| 84 |
-
custom_css = """
|
| 85 |
-
.gradio-container {
|
| 86 |
-
max-width: 1200px;
|
| 87 |
-
margin: auto;
|
| 88 |
-
padding: 16px;
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
-
.container {
|
| 92 |
-
max-width: 800px;
|
| 93 |
-
margin: auto;
|
| 94 |
-
padding: 16px;
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
/* Chat container styles */
|
| 98 |
-
.chat-container {
|
| 99 |
-
display: flex;
|
| 100 |
-
flex-direction: column;
|
| 101 |
-
height: 100%;
|
| 102 |
-
background: white;
|
| 103 |
-
border-radius: 8px;
|
| 104 |
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
| 105 |
-
margin-bottom: 16px;
|
| 106 |
-
}
|
| 107 |
-
|
| 108 |
-
/* Chat message styles */
|
| 109 |
-
.chat-message {
|
| 110 |
-
padding: 12px;
|
| 111 |
-
margin: 8px;
|
| 112 |
-
border-radius: 8px;
|
| 113 |
-
max-width: 85%;
|
| 114 |
-
line-height: 1.5;
|
| 115 |
-
}
|
| 116 |
-
|
| 117 |
-
/* User message styles */
|
| 118 |
-
.user-message {
|
| 119 |
-
background-color: #e3f2fd;
|
| 120 |
-
margin-left: auto;
|
| 121 |
-
}
|
| 122 |
-
|
| 123 |
-
/* Bot message styles */
|
| 124 |
-
.bot-message {
|
| 125 |
-
background-color: #f5f5f5;
|
| 126 |
-
margin-right: auto;
|
| 127 |
-
}
|
| 128 |
-
|
| 129 |
-
/* Input area styles */
|
| 130 |
-
.input-container {
|
| 131 |
-
display: flex;
|
| 132 |
-
gap: 8px;
|
| 133 |
-
padding: 12px;
|
| 134 |
-
background: white;
|
| 135 |
-
border-top: 1px solid #e0e0e0;
|
| 136 |
-
position: sticky;
|
| 137 |
-
bottom: 0;
|
| 138 |
-
}
|
| 139 |
-
|
| 140 |
-
/* Input field styles */
|
| 141 |
-
input[type="text"] {
|
| 142 |
-
flex: 1;
|
| 143 |
-
padding: 8px;
|
| 144 |
-
border: 1px solid #e0e0e0;
|
| 145 |
-
border-radius: 4px;
|
| 146 |
-
font-size: 14px;
|
| 147 |
-
}
|
| 148 |
-
|
| 149 |
-
input[type="text"]:focus {
|
| 150 |
-
border-color: #2196f3;
|
| 151 |
-
outline: none;
|
| 152 |
-
}
|
| 153 |
-
|
| 154 |
-
/* Button styles */
|
| 155 |
-
button {
|
| 156 |
-
padding: 8px 16px;
|
| 157 |
-
border: none;
|
| 158 |
-
border-radius: 4px;
|
| 159 |
-
background-color: #2196f3;
|
| 160 |
-
color: white;
|
| 161 |
-
font-weight: 500;
|
| 162 |
-
cursor: pointer;
|
| 163 |
-
}
|
| 164 |
-
|
| 165 |
-
button:hover {
|
| 166 |
-
background-color: #1976d2;
|
| 167 |
-
}
|
| 168 |
-
|
| 169 |
-
/* Settings panel styles */
|
| 170 |
-
.settings-panel {
|
| 171 |
-
background: white;
|
| 172 |
-
padding: 16px;
|
| 173 |
-
border-radius: 8px;
|
| 174 |
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
| 175 |
-
margin-bottom: 16px;
|
| 176 |
-
}
|
| 177 |
-
|
| 178 |
-
/* Dropdown styles */
|
| 179 |
-
select {
|
| 180 |
-
width: 100%;
|
| 181 |
-
padding: 8px;
|
| 182 |
-
border: 1px solid #e0e0e0;
|
| 183 |
-
border-radius: 4px;
|
| 184 |
-
margin-bottom: 8px;
|
| 185 |
-
}
|
| 186 |
-
|
| 187 |
-
/* Slider styles */
|
| 188 |
-
input[type="range"] {
|
| 189 |
-
width: 100%;
|
| 190 |
-
margin: 8px 0;
|
| 191 |
-
}
|
| 192 |
-
|
| 193 |
-
/* Markdown styles */
|
| 194 |
-
.markdown {
|
| 195 |
-
margin-bottom: 16px;
|
| 196 |
-
}
|
| 197 |
-
|
| 198 |
-
/* Group styles */
|
| 199 |
-
.group {
|
| 200 |
-
margin-bottom: 16px;
|
| 201 |
-
}
|
| 202 |
-
|
| 203 |
-
/* Label styles */
|
| 204 |
-
label {
|
| 205 |
-
margin-bottom: 8px;
|
| 206 |
-
font-weight: 500;
|
| 207 |
-
}
|
| 208 |
-
|
| 209 |
-
/* Header styles */
|
| 210 |
-
h1, h2, h3 {
|
| 211 |
-
margin-bottom: 16px;
|
| 212 |
-
}
|
| 213 |
-
"""
|
| 214 |
-
|
| 215 |
-
with gr.Blocks(css=custom_css) as demo:
|
| 216 |
gr.Markdown("""
|
| 217 |
# π¬ Personalized Movie Recommender
|
| 218 |
|
|
@@ -222,27 +90,24 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 222 |
|
| 223 |
with gr.Row():
|
| 224 |
with gr.Column(scale=2):
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
|
|
|
|
|
|
|
|
|
| 233 |
)
|
| 234 |
-
with gr.
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
show_label=False,
|
| 238 |
-
container=False
|
| 239 |
-
)
|
| 240 |
-
with gr.Row():
|
| 241 |
-
submit = gr.Button("Get Recommendations", variant="primary", size="sm")
|
| 242 |
-
clear = gr.Button("Clear Chat", size="sm")
|
| 243 |
|
| 244 |
with gr.Column(scale=1):
|
| 245 |
-
with gr.Group(
|
| 246 |
gr.Markdown("### π― Recommendation Settings")
|
| 247 |
genre = gr.Dropdown(
|
| 248 |
choices=["Action", "Comedy", "Drama", "Romance", "Thriller", "Sci-Fi", "Fantasy", "Animation"],
|
|
@@ -255,7 +120,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 255 |
multiselect=True
|
| 256 |
)
|
| 257 |
|
| 258 |
-
with gr.Group(
|
| 259 |
gr.Markdown("### π€ Agent Settings")
|
| 260 |
agent_type = gr.Dropdown(
|
| 261 |
choices=["Expert", "Friend", "Film Critic", "Curator"],
|
|
@@ -278,7 +143,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 278 |
value="English"
|
| 279 |
)
|
| 280 |
|
| 281 |
-
with gr.Group(
|
| 282 |
gr.Markdown("### βοΈ Advanced Settings")
|
| 283 |
max_tokens = gr.Slider(
|
| 284 |
minimum=1,
|
|
|
|
| 80 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 81 |
"""
|
| 82 |
|
| 83 |
+
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
gr.Markdown("""
|
| 85 |
# π¬ Personalized Movie Recommender
|
| 86 |
|
|
|
|
| 90 |
|
| 91 |
with gr.Row():
|
| 92 |
with gr.Column(scale=2):
|
| 93 |
+
chatbot = gr.Chatbot(
|
| 94 |
+
height=600,
|
| 95 |
+
show_copy_button=True,
|
| 96 |
+
avatar_images=("π€", "π¬"),
|
| 97 |
+
bubble_full_width=False
|
| 98 |
+
)
|
| 99 |
+
with gr.Row():
|
| 100 |
+
msg = gr.Textbox(
|
| 101 |
+
placeholder="What kind of movie are you looking for?",
|
| 102 |
+
show_label=False,
|
| 103 |
+
container=False
|
| 104 |
)
|
| 105 |
+
with gr.Row():
|
| 106 |
+
submit = gr.Button("Get Recommendations", variant="primary", size="sm")
|
| 107 |
+
clear = gr.Button("Clear Chat", size="sm")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
with gr.Column(scale=1):
|
| 110 |
+
with gr.Group():
|
| 111 |
gr.Markdown("### π― Recommendation Settings")
|
| 112 |
genre = gr.Dropdown(
|
| 113 |
choices=["Action", "Comedy", "Drama", "Romance", "Thriller", "Sci-Fi", "Fantasy", "Animation"],
|
|
|
|
| 120 |
multiselect=True
|
| 121 |
)
|
| 122 |
|
| 123 |
+
with gr.Group():
|
| 124 |
gr.Markdown("### π€ Agent Settings")
|
| 125 |
agent_type = gr.Dropdown(
|
| 126 |
choices=["Expert", "Friend", "Film Critic", "Curator"],
|
|
|
|
| 143 |
value="English"
|
| 144 |
)
|
| 145 |
|
| 146 |
+
with gr.Group():
|
| 147 |
gr.Markdown("### βοΈ Advanced Settings")
|
| 148 |
max_tokens = gr.Slider(
|
| 149 |
minimum=1,
|