hajar-bettiche-07
commited on
Commit
·
d3227db
1
Parent(s):
420be92
another version of UI
Browse files
app.py
CHANGED
|
@@ -30,16 +30,14 @@ def clickTrigger(book_name):
|
|
| 30 |
|
| 31 |
with gr.Blocks(
|
| 32 |
css="""
|
| 33 |
-
/* Global Styles */
|
| 34 |
.gradio-container {
|
| 35 |
max-width: 100% !important;
|
| 36 |
padding: 0 !important;
|
| 37 |
margin: 0 !important;
|
| 38 |
-
background: white !important;
|
| 39 |
-
font-family: system-ui, -apple-system, sans-serif !important;
|
| 40 |
}
|
| 41 |
|
| 42 |
-
/* Supprimer TOUS les gaps et marges */
|
| 43 |
.gradio-container > .contain {
|
| 44 |
gap: 0 !important;
|
| 45 |
margin: 0 !important;
|
|
@@ -53,252 +51,376 @@ with gr.Blocks(
|
|
| 53 |
padding-bottom: 0 !important;
|
| 54 |
}
|
| 55 |
|
| 56 |
-
/* Header Section -
|
| 57 |
.header-section {
|
| 58 |
-
background: linear-gradient(135deg, #
|
| 59 |
-
padding:
|
| 60 |
margin: 0 !important;
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
}
|
| 63 |
|
| 64 |
.header-content {
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
margin: 0 auto;
|
| 67 |
-
padding: 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
}
|
| 69 |
|
| 70 |
.header-text h1 {
|
| 71 |
color: white;
|
| 72 |
-
font-size:
|
| 73 |
font-weight: 700;
|
| 74 |
-
margin: 0 0
|
| 75 |
letter-spacing: -0.5px;
|
| 76 |
-
line-height: 1.1;
|
| 77 |
}
|
| 78 |
|
| 79 |
.header-text p {
|
| 80 |
-
color: rgba(255, 255, 255, 0.
|
| 81 |
-
font-size:
|
| 82 |
margin: 0;
|
| 83 |
font-weight: 400;
|
| 84 |
-
line-height: 1.4;
|
| 85 |
}
|
| 86 |
|
| 87 |
-
/*
|
| 88 |
.features-section {
|
| 89 |
-
background:
|
| 90 |
-
padding:
|
| 91 |
margin: 0 !important;
|
|
|
|
| 92 |
}
|
| 93 |
|
| 94 |
.features-grid {
|
| 95 |
display: grid;
|
| 96 |
-
grid-template-columns: 1fr;
|
| 97 |
-
gap:
|
| 98 |
-
max-width:
|
| 99 |
margin: 0 auto;
|
| 100 |
-
padding: 0
|
| 101 |
}
|
| 102 |
|
| 103 |
-
.feature-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
text-align: center;
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
}
|
| 107 |
|
| 108 |
-
.feature-
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
font-weight: 600;
|
| 111 |
-
color: #
|
| 112 |
-
margin: 0 0
|
| 113 |
-
line-height: 1.3;
|
| 114 |
}
|
| 115 |
|
| 116 |
-
.feature-
|
| 117 |
-
font-size:
|
| 118 |
-
color: #
|
| 119 |
-
line-height: 1.
|
| 120 |
margin: 0;
|
| 121 |
}
|
| 122 |
|
| 123 |
-
/* Search Section -
|
| 124 |
-
.search-section {
|
| 125 |
background: white;
|
| 126 |
-
padding:
|
| 127 |
margin: 0 !important;
|
| 128 |
-
|
| 129 |
}
|
| 130 |
|
| 131 |
-
.search-
|
| 132 |
-
max-width:
|
| 133 |
margin: 0 auto;
|
| 134 |
-
padding: 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
}
|
| 136 |
|
| 137 |
.search-title {
|
|
|
|
|
|
|
|
|
|
| 138 |
margin-bottom: 20px;
|
| 139 |
}
|
| 140 |
|
| 141 |
.search-title h2 {
|
| 142 |
-
font-size:
|
| 143 |
-
font-weight:
|
| 144 |
-
color: #
|
| 145 |
-
margin: 0
|
| 146 |
-
line-height: 1.2;
|
| 147 |
}
|
| 148 |
|
| 149 |
.search-subtitle {
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
margin: 0;
|
| 154 |
}
|
| 155 |
|
| 156 |
-
/* Search
|
| 157 |
.search-inputs {
|
| 158 |
-
max-width:
|
| 159 |
-
margin: 0 auto !important;
|
| 160 |
-
padding: 0
|
|
|
|
| 161 |
}
|
| 162 |
|
| 163 |
.search-box-container {
|
| 164 |
display: flex;
|
| 165 |
-
gap:
|
| 166 |
-
margin-bottom:
|
| 167 |
-
|
|
|
|
| 168 |
}
|
| 169 |
|
| 170 |
.search-box-container input {
|
| 171 |
flex: 1;
|
| 172 |
-
padding:
|
| 173 |
-
border:
|
| 174 |
-
border-radius:
|
| 175 |
-
font-size:
|
| 176 |
background: white !important;
|
| 177 |
-
|
| 178 |
}
|
| 179 |
|
| 180 |
.search-box-container input:focus {
|
| 181 |
-
border-color: #
|
| 182 |
outline: none !important;
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
.search-box-container input::placeholder {
|
| 186 |
-
color: #9ca3af !important;
|
| 187 |
}
|
| 188 |
|
| 189 |
.search-button {
|
| 190 |
-
padding:
|
| 191 |
-
background: #
|
| 192 |
color: white !important;
|
| 193 |
border: none !important;
|
| 194 |
-
border-radius:
|
| 195 |
-
font-size:
|
| 196 |
-
font-weight:
|
| 197 |
cursor: pointer !important;
|
| 198 |
-
|
|
|
|
|
|
|
| 199 |
}
|
| 200 |
|
| 201 |
.search-button:hover {
|
| 202 |
-
|
|
|
|
|
|
|
| 203 |
}
|
| 204 |
|
| 205 |
.status-message {
|
| 206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
margin: 0 auto !important;
|
| 208 |
-
|
| 209 |
-
font-size: 0.9rem;
|
| 210 |
}
|
| 211 |
|
| 212 |
-
/* Chat Section -
|
| 213 |
.chat-section-wrapper {
|
| 214 |
-
background:
|
| 215 |
-
padding:
|
| 216 |
margin: 0 !important;
|
| 217 |
-
border-
|
| 218 |
}
|
| 219 |
|
| 220 |
.chat-section {
|
| 221 |
-
max-width:
|
| 222 |
margin: 0 auto !important;
|
| 223 |
-
padding: 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
}
|
| 225 |
|
| 226 |
.chat-header {
|
| 227 |
-
|
| 228 |
-
|
|
|
|
|
|
|
|
|
|
| 229 |
}
|
| 230 |
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
}
|
| 238 |
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
overflow: hidden;
|
| 245 |
}
|
| 246 |
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
max-height: 300px !important;
|
| 253 |
-
box-shadow: none !important;
|
| 254 |
}
|
| 255 |
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
padding:
|
| 261 |
-
|
| 262 |
-
|
|
|
|
|
|
|
|
|
|
| 263 |
}
|
| 264 |
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
border-radius:
|
| 271 |
-
|
| 272 |
-
font-weight: 500 !important;
|
| 273 |
-
margin-left: 8px !important;
|
| 274 |
}
|
| 275 |
|
| 276 |
-
|
| 277 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
}
|
| 279 |
|
| 280 |
-
/*
|
| 281 |
.gradio-row {
|
| 282 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 283 |
}
|
| 284 |
|
| 285 |
-
/*
|
| 286 |
-
|
|
|
|
| 287 |
margin: 0 !important;
|
| 288 |
-
padding: 0 !important;
|
| 289 |
}
|
| 290 |
|
| 291 |
-
/*
|
| 292 |
-
.
|
| 293 |
-
|
|
|
|
| 294 |
}
|
| 295 |
"""
|
| 296 |
) as demo:
|
| 297 |
|
| 298 |
-
# Header
|
| 299 |
gr.HTML("""
|
| 300 |
<div class="header-section">
|
| 301 |
<div class="header-content">
|
|
|
|
| 302 |
<div class="header-text">
|
| 303 |
<h1>Welcome to ChatBook</h1>
|
| 304 |
<p>Your intelligent reading companion</p>
|
|
@@ -307,78 +429,88 @@ with gr.Blocks(
|
|
| 307 |
</div>
|
| 308 |
""")
|
| 309 |
|
| 310 |
-
#
|
| 311 |
gr.HTML("""
|
| 312 |
<div class="features-section">
|
| 313 |
<div class="features-grid">
|
| 314 |
-
<div class="feature-
|
|
|
|
| 315 |
<h3>Deep Discussions</h3>
|
| 316 |
<p>Ask complex questions about plot, themes, and characters</p>
|
| 317 |
</div>
|
| 318 |
-
<div class="feature-
|
|
|
|
| 319 |
<h3>Instant Answers</h3>
|
| 320 |
<p>Get immediate AI-powered responses about any book</p>
|
| 321 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 322 |
</div>
|
| 323 |
</div>
|
| 324 |
""")
|
| 325 |
|
| 326 |
-
# Search Section
|
| 327 |
gr.HTML("""
|
| 328 |
-
<div class="search-section">
|
| 329 |
-
<div class="search-
|
| 330 |
-
<div class="search-
|
| 331 |
-
<
|
| 332 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 333 |
</div>
|
| 334 |
</div>
|
| 335 |
</div>
|
| 336 |
""")
|
| 337 |
|
| 338 |
-
# Search Inputs
|
| 339 |
with gr.Group(elem_classes="search-inputs"):
|
| 340 |
with gr.Row(elem_classes="search-box-container"):
|
| 341 |
book_box = gr.Textbox(
|
| 342 |
-
placeholder="Enter book title...",
|
| 343 |
show_label=False,
|
| 344 |
container=False,
|
| 345 |
-
scale=
|
| 346 |
)
|
| 347 |
-
search_btn = gr.Button("Search", elem_classes="search-button", scale=
|
| 348 |
|
| 349 |
status_text = gr.HTML("", visible=False)
|
| 350 |
|
| 351 |
-
# Chat Section
|
| 352 |
with gr.Group(visible=False) as chat_section:
|
| 353 |
gr.HTML("""
|
| 354 |
<div class="chat-section-wrapper">
|
| 355 |
<div class="chat-section">
|
| 356 |
-
<div class="chat-header">
|
| 357 |
-
|
| 358 |
-
</div>
|
| 359 |
""")
|
| 360 |
|
| 361 |
-
# Chat Interface - SIMPLE COMME L'IMAGE
|
| 362 |
chat = gr.ChatInterface(
|
| 363 |
fn=echo,
|
| 364 |
type="messages",
|
| 365 |
-
chatbot=gr.Chatbot(
|
| 366 |
-
height=200,
|
| 367 |
-
type="messages",
|
| 368 |
-
show_label=False,
|
| 369 |
-
container=False,
|
| 370 |
-
show_copy_button=False
|
| 371 |
-
),
|
| 372 |
textbox=gr.Textbox(
|
| 373 |
-
placeholder="
|
| 374 |
container=False,
|
| 375 |
-
scale=
|
| 376 |
-
)
|
| 377 |
-
submit_btn="Send",
|
| 378 |
-
title=""
|
| 379 |
)
|
| 380 |
|
| 381 |
gr.HTML("""
|
|
|
|
| 382 |
</div>
|
| 383 |
</div>
|
| 384 |
""")
|
|
|
|
| 30 |
|
| 31 |
with gr.Blocks(
|
| 32 |
css="""
|
| 33 |
+
/* Global Styles - ELIMINER LES ESPACES */
|
| 34 |
.gradio-container {
|
| 35 |
max-width: 100% !important;
|
| 36 |
padding: 0 !important;
|
| 37 |
margin: 0 !important;
|
|
|
|
|
|
|
| 38 |
}
|
| 39 |
|
| 40 |
+
/* Supprimer TOUS les gaps et marges entre les sections */
|
| 41 |
.gradio-container > .contain {
|
| 42 |
gap: 0 !important;
|
| 43 |
margin: 0 !important;
|
|
|
|
| 51 |
padding-bottom: 0 !important;
|
| 52 |
}
|
| 53 |
|
| 54 |
+
/* Header Section - COINS COURBÉS EN BAS */
|
| 55 |
.header-section {
|
| 56 |
+
background: linear-gradient(135deg, #d97706 0%, #dc2626 100%);
|
| 57 |
+
padding: 100px 0 80px 0 !important;
|
| 58 |
margin: 0 !important;
|
| 59 |
+
position: relative;
|
| 60 |
+
overflow: hidden;
|
| 61 |
+
border-radius: 0 0 30px 30px !important;
|
| 62 |
+
min-height: 300px;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
.header-section::before {
|
| 66 |
+
content: '';
|
| 67 |
+
position: absolute;
|
| 68 |
+
top: 0;
|
| 69 |
+
left: 0;
|
| 70 |
+
right: 0;
|
| 71 |
+
bottom: 0;
|
| 72 |
+
background-image: repeating-linear-gradient(
|
| 73 |
+
90deg,
|
| 74 |
+
rgba(255, 255, 255, 0.03) 0px,
|
| 75 |
+
rgba(255, 255, 255, 0.03) 2px,
|
| 76 |
+
transparent 2px,
|
| 77 |
+
transparent 20px
|
| 78 |
+
);
|
| 79 |
+
pointer-events: none;
|
| 80 |
}
|
| 81 |
|
| 82 |
.header-content {
|
| 83 |
+
display: flex;
|
| 84 |
+
align-items: center;
|
| 85 |
+
gap: 30px;
|
| 86 |
+
position: relative;
|
| 87 |
+
z-index: 1;
|
| 88 |
+
max-width: 1400px;
|
| 89 |
margin: 0 auto;
|
| 90 |
+
padding: 0 80px;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
.header-icon {
|
| 94 |
+
width: 100px;
|
| 95 |
+
height: 100px;
|
| 96 |
+
background: rgba(255, 255, 255, 0.2);
|
| 97 |
+
border-radius: 25px;
|
| 98 |
+
display: flex;
|
| 99 |
+
align-items: center;
|
| 100 |
+
justify-content: center;
|
| 101 |
+
font-size: 60px;
|
| 102 |
+
backdrop-filter: blur(10px);
|
| 103 |
}
|
| 104 |
|
| 105 |
.header-text h1 {
|
| 106 |
color: white;
|
| 107 |
+
font-size: 56px;
|
| 108 |
font-weight: 700;
|
| 109 |
+
margin: 0 0 12px 0;
|
| 110 |
letter-spacing: -0.5px;
|
|
|
|
| 111 |
}
|
| 112 |
|
| 113 |
.header-text p {
|
| 114 |
+
color: rgba(255, 255, 255, 0.95);
|
| 115 |
+
font-size: 24px;
|
| 116 |
margin: 0;
|
| 117 |
font-weight: 400;
|
|
|
|
| 118 |
}
|
| 119 |
|
| 120 |
+
/* Feature Cards Section - COINS COURBÉS EN HAUT ET EN BAS */
|
| 121 |
.features-section {
|
| 122 |
+
background: linear-gradient(135deg, #f5e6d3 0%, #e8d4b8 100%);
|
| 123 |
+
padding: 60px 0 !important;
|
| 124 |
margin: 0 !important;
|
| 125 |
+
border-radius: 0 !important;
|
| 126 |
}
|
| 127 |
|
| 128 |
.features-grid {
|
| 129 |
display: grid;
|
| 130 |
+
grid-template-columns: repeat(4, 1fr);
|
| 131 |
+
gap: 24px;
|
| 132 |
+
max-width: 1400px;
|
| 133 |
margin: 0 auto;
|
| 134 |
+
padding: 0 80px;
|
| 135 |
}
|
| 136 |
|
| 137 |
+
.feature-card {
|
| 138 |
+
background: white;
|
| 139 |
+
border: 2px solid #d2b48c;
|
| 140 |
+
border-radius: 20px;
|
| 141 |
+
padding: 32px 24px;
|
| 142 |
text-align: center;
|
| 143 |
+
box-shadow: 0 4px 12px rgba(139, 69, 19, 0.1);
|
| 144 |
+
transition: all 0.3s ease;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
.feature-card:hover {
|
| 148 |
+
transform: translateY(-4px);
|
| 149 |
+
box-shadow: 0 8px 20px rgba(139, 69, 19, 0.2);
|
| 150 |
+
border-color: #d2691e;
|
| 151 |
}
|
| 152 |
|
| 153 |
+
.feature-icon {
|
| 154 |
+
width: 56px;
|
| 155 |
+
height: 56px;
|
| 156 |
+
background: linear-gradient(135deg, #d2691e 0%, #a0522d 100%);
|
| 157 |
+
border-radius: 12px;
|
| 158 |
+
display: flex;
|
| 159 |
+
align-items: center;
|
| 160 |
+
justify-content: center;
|
| 161 |
+
margin: 0 auto 20px auto;
|
| 162 |
+
font-size: 28px;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
.feature-card h3 {
|
| 166 |
+
font-size: 18px;
|
| 167 |
font-weight: 600;
|
| 168 |
+
color: #1f2937;
|
| 169 |
+
margin: 0 0 12px 0;
|
|
|
|
| 170 |
}
|
| 171 |
|
| 172 |
+
.feature-card p {
|
| 173 |
+
font-size: 14px;
|
| 174 |
+
color: #6b7280;
|
| 175 |
+
line-height: 1.6;
|
| 176 |
margin: 0;
|
| 177 |
}
|
| 178 |
|
| 179 |
+
/* Search Section - COINS COURBÉS EN HAUT ET EN BAS */
|
| 180 |
+
.search-section-wrapper {
|
| 181 |
background: white;
|
| 182 |
+
padding: 80px 0 !important;
|
| 183 |
margin: 0 !important;
|
| 184 |
+
border-radius: 0 !important;
|
| 185 |
}
|
| 186 |
|
| 187 |
+
.search-section {
|
| 188 |
+
max-width: 1400px;
|
| 189 |
margin: 0 auto;
|
| 190 |
+
padding: 0 80px;
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
.search-card {
|
| 194 |
+
background: linear-gradient(135deg, #ffe4cc 0%, #ffd4a3 100%);
|
| 195 |
+
border: 2px solid #ffb366;
|
| 196 |
+
border-radius: 25px;
|
| 197 |
+
padding: 60px;
|
| 198 |
+
box-shadow: 0 6px 16px rgba(255, 140, 0, 0.2);
|
| 199 |
+
display: flex;
|
| 200 |
+
gap: 50px;
|
| 201 |
+
align-items: center;
|
| 202 |
+
min-height: 280px;
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
.search-image {
|
| 206 |
+
flex-shrink: 0;
|
| 207 |
+
width: 350px;
|
| 208 |
+
height: 240px;
|
| 209 |
+
border-radius: 20px;
|
| 210 |
+
overflow: hidden;
|
| 211 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
.search-image img {
|
| 215 |
+
width: 100%;
|
| 216 |
+
height: 100%;
|
| 217 |
+
object-fit: cover;
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
.search-content {
|
| 221 |
+
flex: 1;
|
| 222 |
}
|
| 223 |
|
| 224 |
.search-title {
|
| 225 |
+
display: flex;
|
| 226 |
+
align-items: center;
|
| 227 |
+
gap: 12px;
|
| 228 |
margin-bottom: 20px;
|
| 229 |
}
|
| 230 |
|
| 231 |
.search-title h2 {
|
| 232 |
+
font-size: 38px;
|
| 233 |
+
font-weight: 700;
|
| 234 |
+
color: #8b4513;
|
| 235 |
+
margin: 0;
|
|
|
|
| 236 |
}
|
| 237 |
|
| 238 |
.search-subtitle {
|
| 239 |
+
color: #654321;
|
| 240 |
+
font-size: 18px;
|
| 241 |
+
margin-bottom: 0;
|
|
|
|
| 242 |
}
|
| 243 |
|
| 244 |
+
/* Search Inputs - MARGES ALIGNÉES */
|
| 245 |
.search-inputs {
|
| 246 |
+
max-width: 1400px !important;
|
| 247 |
+
margin: 30px auto 0 auto !important;
|
| 248 |
+
padding: 0 80px !important;
|
| 249 |
+
width: auto !important;
|
| 250 |
}
|
| 251 |
|
| 252 |
.search-box-container {
|
| 253 |
display: flex;
|
| 254 |
+
gap: 12px;
|
| 255 |
+
margin-bottom: 16px;
|
| 256 |
+
width: 100% !important;
|
| 257 |
+
max-width: 100% !important;
|
| 258 |
}
|
| 259 |
|
| 260 |
.search-box-container input {
|
| 261 |
flex: 1;
|
| 262 |
+
padding: 16px 24px !important;
|
| 263 |
+
border: 2px solid #d2691e !important;
|
| 264 |
+
border-radius: 15px !important;
|
| 265 |
+
font-size: 16px !important;
|
| 266 |
background: white !important;
|
| 267 |
+
width: 100% !important;
|
| 268 |
}
|
| 269 |
|
| 270 |
.search-box-container input:focus {
|
| 271 |
+
border-color: #8b4513 !important;
|
| 272 |
outline: none !important;
|
| 273 |
+
box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1) !important;
|
|
|
|
|
|
|
|
|
|
| 274 |
}
|
| 275 |
|
| 276 |
.search-button {
|
| 277 |
+
padding: 16px 40px !important;
|
| 278 |
+
background: linear-gradient(135deg, #8b4513 0%, #a0522d 100%) !important;
|
| 279 |
color: white !important;
|
| 280 |
border: none !important;
|
| 281 |
+
border-radius: 15px !important;
|
| 282 |
+
font-size: 16px !important;
|
| 283 |
+
font-weight: 600 !important;
|
| 284 |
cursor: pointer !important;
|
| 285 |
+
transition: all 0.3s ease !important;
|
| 286 |
+
box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3) !important;
|
| 287 |
+
white-space: nowrap !important;
|
| 288 |
}
|
| 289 |
|
| 290 |
.search-button:hover {
|
| 291 |
+
transform: translateY(-2px);
|
| 292 |
+
box-shadow: 0 6px 16px rgba(139, 69, 19, 0.4) !important;
|
| 293 |
+
background: linear-gradient(135deg, #a0522d 0%, #8b4513 100%) !important;
|
| 294 |
}
|
| 295 |
|
| 296 |
.status-message {
|
| 297 |
+
padding: 12px 20px;
|
| 298 |
+
border-radius: 12px;
|
| 299 |
+
font-size: 14px;
|
| 300 |
+
font-weight: 500;
|
| 301 |
+
max-width: 1400px !important;
|
| 302 |
margin: 0 auto !important;
|
| 303 |
+
width: auto !important;
|
|
|
|
| 304 |
}
|
| 305 |
|
| 306 |
+
/* Chat Section - COINS COURBÉS EN HAUT ET MARGES ALIGNÉES */
|
| 307 |
.chat-section-wrapper {
|
| 308 |
+
background: white;
|
| 309 |
+
padding: 60px 0 80px 0 !important;
|
| 310 |
margin: 0 !important;
|
| 311 |
+
border-radius: 30px 30px 0 0 !important;
|
| 312 |
}
|
| 313 |
|
| 314 |
.chat-section {
|
| 315 |
+
max-width: 1400px !important;
|
| 316 |
margin: 0 auto !important;
|
| 317 |
+
padding: 0 80px !important;
|
| 318 |
+
width: auto !important;
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
.chat-container {
|
| 322 |
+
background: white;
|
| 323 |
+
border: 2px solid #e5e7eb;
|
| 324 |
+
border-radius: 25px;
|
| 325 |
+
padding: 32px;
|
| 326 |
+
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
|
| 327 |
+
width: 100% !important;
|
| 328 |
+
max-width: 100% !important;
|
| 329 |
+
margin: 0 !important;
|
| 330 |
}
|
| 331 |
|
| 332 |
.chat-header {
|
| 333 |
+
font-size: 24px;
|
| 334 |
+
font-weight: 700;
|
| 335 |
+
color: #1f2937;
|
| 336 |
+
margin-bottom: 24px;
|
| 337 |
+
width: 100% !important;
|
| 338 |
}
|
| 339 |
|
| 340 |
+
/* FORCER la suppression de tous les espaces entre les blocs Gradio */
|
| 341 |
+
div[data-testid]:has(.header-section) {
|
| 342 |
+
margin-bottom: 0 !important;
|
| 343 |
+
padding-bottom: 0 !important;
|
| 344 |
+
border-radius: 0 0 30px 30px !important;
|
| 345 |
+
overflow: hidden !important;
|
| 346 |
}
|
| 347 |
|
| 348 |
+
div[data-testid]:has(.features-section) {
|
| 349 |
+
margin-top: 0 !important;
|
| 350 |
+
margin-bottom: 0 !important;
|
| 351 |
+
padding-top: 0 !important;
|
| 352 |
+
padding-bottom: 0 !important;
|
|
|
|
| 353 |
}
|
| 354 |
|
| 355 |
+
div[data-testid]:has(.search-section-wrapper) {
|
| 356 |
+
margin-top: 0 !important;
|
| 357 |
+
margin-bottom: 0 !important;
|
| 358 |
+
padding-top: 0 !important;
|
| 359 |
+
padding-bottom: 0 !important;
|
|
|
|
|
|
|
| 360 |
}
|
| 361 |
|
| 362 |
+
div[data-testid]:has(.search-inputs) {
|
| 363 |
+
margin-top: 0 !important;
|
| 364 |
+
margin-bottom: 0 !important;
|
| 365 |
+
padding-top: 0 !important;
|
| 366 |
+
padding-bottom: 0 !important;
|
| 367 |
+
max-width: 1400px !important;
|
| 368 |
+
margin-left: auto !important;
|
| 369 |
+
margin-right: auto !important;
|
| 370 |
+
padding-left: 80px !important;
|
| 371 |
+
padding-right: 80px !important;
|
| 372 |
}
|
| 373 |
|
| 374 |
+
div[data-testid]:has(.chat-section-wrapper) {
|
| 375 |
+
margin-top: 0 !important;
|
| 376 |
+
margin-bottom: 0 !important;
|
| 377 |
+
padding-top: 0 !important;
|
| 378 |
+
padding-bottom: 0 !important;
|
| 379 |
+
border-radius: 30px 30px 0 0 !important;
|
| 380 |
+
overflow: hidden !important;
|
|
|
|
|
|
|
| 381 |
}
|
| 382 |
|
| 383 |
+
/* Assurer l'alignement parfait de tous les conteneurs */
|
| 384 |
+
.header-content,
|
| 385 |
+
.features-grid,
|
| 386 |
+
.search-section,
|
| 387 |
+
.search-inputs,
|
| 388 |
+
.chat-section {
|
| 389 |
+
margin-left: auto !important;
|
| 390 |
+
margin-right: auto !important;
|
| 391 |
+
padding-left: 80px !important;
|
| 392 |
+
padding-right: 80px !important;
|
| 393 |
+
box-sizing: border-box !important;
|
| 394 |
}
|
| 395 |
|
| 396 |
+
/* Correction spécifique pour les inputs */
|
| 397 |
.gradio-row {
|
| 398 |
+
max-width: 1400px !important;
|
| 399 |
+
margin-left: auto !important;
|
| 400 |
+
margin-right: auto !important;
|
| 401 |
+
padding-left: 80px !important;
|
| 402 |
+
padding-right: 80px !important;
|
| 403 |
}
|
| 404 |
|
| 405 |
+
/* Pour le chatbot */
|
| 406 |
+
.gradio-chatbot {
|
| 407 |
+
max-width: 100% !important;
|
| 408 |
margin: 0 !important;
|
|
|
|
| 409 |
}
|
| 410 |
|
| 411 |
+
/* Pour la textbox du chat */
|
| 412 |
+
.gradio-textbox {
|
| 413 |
+
max-width: 100% !important;
|
| 414 |
+
margin: 0 !important;
|
| 415 |
}
|
| 416 |
"""
|
| 417 |
) as demo:
|
| 418 |
|
| 419 |
+
# Header - COINS COURBÉS EN BAS
|
| 420 |
gr.HTML("""
|
| 421 |
<div class="header-section">
|
| 422 |
<div class="header-content">
|
| 423 |
+
<div class="header-icon">📖</div>
|
| 424 |
<div class="header-text">
|
| 425 |
<h1>Welcome to ChatBook</h1>
|
| 426 |
<p>Your intelligent reading companion</p>
|
|
|
|
| 429 |
</div>
|
| 430 |
""")
|
| 431 |
|
| 432 |
+
# Feature Cards
|
| 433 |
gr.HTML("""
|
| 434 |
<div class="features-section">
|
| 435 |
<div class="features-grid">
|
| 436 |
+
<div class="feature-card">
|
| 437 |
+
<div class="feature-icon">💬</div>
|
| 438 |
<h3>Deep Discussions</h3>
|
| 439 |
<p>Ask complex questions about plot, themes, and characters</p>
|
| 440 |
</div>
|
| 441 |
+
<div class="feature-card">
|
| 442 |
+
<div class="feature-icon">⚡</div>
|
| 443 |
<h3>Instant Answers</h3>
|
| 444 |
<p>Get immediate AI-powered responses about any book</p>
|
| 445 |
</div>
|
| 446 |
+
<div class="feature-card">
|
| 447 |
+
<div class="feature-icon">⏱️</div>
|
| 448 |
+
<h3>Save Time</h3>
|
| 449 |
+
<p>No need to re-read - get quick summaries and insights</p>
|
| 450 |
+
</div>
|
| 451 |
+
<div class="feature-card">
|
| 452 |
+
<div class="feature-icon">📈</div>
|
| 453 |
+
<h3>Learn More</h3>
|
| 454 |
+
<p>Discover hidden meanings and literary analysis</p>
|
| 455 |
+
</div>
|
| 456 |
</div>
|
| 457 |
</div>
|
| 458 |
""")
|
| 459 |
|
| 460 |
+
# Search Section
|
| 461 |
gr.HTML("""
|
| 462 |
+
<div class="search-section-wrapper">
|
| 463 |
+
<div class="search-section">
|
| 464 |
+
<div class="search-card">
|
| 465 |
+
<div class="search-image">
|
| 466 |
+
<img src="https://images.unsplash.com/photo-1524995997946-a1c2e315a42f?w=600&h=400&fit=crop" alt="Person reading">
|
| 467 |
+
</div>
|
| 468 |
+
<div class="search-content">
|
| 469 |
+
<div class="search-title">
|
| 470 |
+
<span style="font-size: 38px;"></span>
|
| 471 |
+
<h2>Find Your Book</h2>
|
| 472 |
+
</div>
|
| 473 |
+
<p class="search-subtitle">Enter a book title and start an intelligent conversation about it</p>
|
| 474 |
+
</div>
|
| 475 |
</div>
|
| 476 |
</div>
|
| 477 |
</div>
|
| 478 |
""")
|
| 479 |
|
|
|
|
| 480 |
with gr.Group(elem_classes="search-inputs"):
|
| 481 |
with gr.Row(elem_classes="search-box-container"):
|
| 482 |
book_box = gr.Textbox(
|
| 483 |
+
placeholder="Enter book title (e.g, The Great Gatsby)...",
|
| 484 |
show_label=False,
|
| 485 |
container=False,
|
| 486 |
+
scale=5
|
| 487 |
)
|
| 488 |
+
search_btn = gr.Button("🔍 Search", elem_classes="search-button", scale=1)
|
| 489 |
|
| 490 |
status_text = gr.HTML("", visible=False)
|
| 491 |
|
| 492 |
+
# Chat Section - COINS COURBÉS EN HAUT
|
| 493 |
with gr.Group(visible=False) as chat_section:
|
| 494 |
gr.HTML("""
|
| 495 |
<div class="chat-section-wrapper">
|
| 496 |
<div class="chat-section">
|
| 497 |
+
<div class="chat-header">💬 Chat with Your Book</div>
|
| 498 |
+
<div class="chat-container">
|
|
|
|
| 499 |
""")
|
| 500 |
|
|
|
|
| 501 |
chat = gr.ChatInterface(
|
| 502 |
fn=echo,
|
| 503 |
type="messages",
|
| 504 |
+
chatbot=gr.Chatbot(height=500, type="messages"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 505 |
textbox=gr.Textbox(
|
| 506 |
+
placeholder="Ask anything about the book...",
|
| 507 |
container=False,
|
| 508 |
+
scale=7
|
| 509 |
+
)
|
|
|
|
|
|
|
| 510 |
)
|
| 511 |
|
| 512 |
gr.HTML("""
|
| 513 |
+
</div>
|
| 514 |
</div>
|
| 515 |
</div>
|
| 516 |
""")
|