Update app.py
Browse files
app.py
CHANGED
|
@@ -137,19 +137,6 @@ def format_face_comparison_result(result, img1_path, img2_path):
|
|
| 137 |
html += "</div>"
|
| 138 |
return html
|
| 139 |
|
| 140 |
-
def create_footer():
|
| 141 |
-
"""Create simple footer"""
|
| 142 |
-
return """
|
| 143 |
-
<div class="footer">
|
| 144 |
-
<p>© 2024 MiniAiLive. All rights reserved.</p>
|
| 145 |
-
<p>
|
| 146 |
-
<a href="https://www.miniai.live" target="_blank">Website</a> |
|
| 147 |
-
<a href="mailto:info@miniai.live">Contact Us</a> |
|
| 148 |
-
<a href="https://www.miniai.live/privacy-policy" target="_blank">Privacy Policy</a>
|
| 149 |
-
</p>
|
| 150 |
-
</div>
|
| 151 |
-
"""
|
| 152 |
-
|
| 153 |
def get_custom_css():
|
| 154 |
"""Return simplified CSS styling that works for both light and dark themes"""
|
| 155 |
return """
|
|
@@ -160,6 +147,7 @@ def get_custom_css():
|
|
| 160 |
max-width: 95% !important;
|
| 161 |
width: 95% !important;
|
| 162 |
margin: 0 auto !important;
|
|
|
|
| 163 |
}
|
| 164 |
|
| 165 |
/* Center everything */
|
|
@@ -174,14 +162,14 @@ def get_custom_css():
|
|
| 174 |
/* Header styling - logo and text in same line */
|
| 175 |
.company-header {
|
| 176 |
background: var(--background-fill-primary);
|
| 177 |
-
padding:
|
| 178 |
-
margin-bottom:
|
| 179 |
text-align: center;
|
| 180 |
width: 100%;
|
| 181 |
display: flex;
|
| 182 |
align-items: center;
|
| 183 |
justify-content: center;
|
| 184 |
-
gap:
|
| 185 |
flex-wrap: wrap;
|
| 186 |
}
|
| 187 |
|
|
@@ -190,7 +178,7 @@ def get_custom_css():
|
|
| 190 |
}
|
| 191 |
|
| 192 |
.header-logo img {
|
| 193 |
-
width:
|
| 194 |
height: auto;
|
| 195 |
}
|
| 196 |
|
|
@@ -199,15 +187,15 @@ def get_custom_css():
|
|
| 199 |
}
|
| 200 |
|
| 201 |
.header-text h1 {
|
| 202 |
-
font-size:
|
| 203 |
-
margin-bottom:
|
| 204 |
-
font-weight:
|
| 205 |
margin-top: 0;
|
| 206 |
color: var(--body-text-color);
|
| 207 |
}
|
| 208 |
|
| 209 |
.header-text p {
|
| 210 |
-
font-size: 1.
|
| 211 |
margin-bottom: 0;
|
| 212 |
color: var(--body-text-color);
|
| 213 |
opacity: 0.8;
|
|
@@ -216,27 +204,28 @@ def get_custom_css():
|
|
| 216 |
/* About section layout */
|
| 217 |
.about-section {
|
| 218 |
width: 100%;
|
| 219 |
-
margin-bottom:
|
| 220 |
}
|
| 221 |
|
| 222 |
.about-content {
|
| 223 |
display: flex;
|
| 224 |
-
gap:
|
| 225 |
width: 100%;
|
| 226 |
}
|
| 227 |
|
| 228 |
.features-section {
|
| 229 |
flex: 0.6;
|
| 230 |
-
padding:
|
| 231 |
background: var(--background-fill-secondary);
|
| 232 |
-
border-radius:
|
|
|
|
| 233 |
}
|
| 234 |
|
| 235 |
.demo-items-section {
|
| 236 |
flex: 0.4;
|
| 237 |
-
padding:
|
| 238 |
background: var(--background-fill-secondary);
|
| 239 |
-
border-radius:
|
| 240 |
}
|
| 241 |
|
| 242 |
.demo-items-grid {
|
|
@@ -247,8 +236,8 @@ def get_custom_css():
|
|
| 247 |
|
| 248 |
.demo-item {
|
| 249 |
background: var(--background-fill-primary);
|
| 250 |
-
padding:
|
| 251 |
-
border-radius:
|
| 252 |
text-align: center;
|
| 253 |
transition: background-color 0.2s ease;
|
| 254 |
display: flex;
|
|
@@ -257,6 +246,7 @@ def get_custom_css():
|
|
| 257 |
justify-content: center;
|
| 258 |
text-decoration: none;
|
| 259 |
color: var(--body-text-color);
|
|
|
|
| 260 |
}
|
| 261 |
|
| 262 |
.demo-item:hover {
|
|
@@ -264,28 +254,28 @@ def get_custom_css():
|
|
| 264 |
}
|
| 265 |
|
| 266 |
.demo-item img {
|
| 267 |
-
height:
|
| 268 |
-
margin-bottom:
|
| 269 |
}
|
| 270 |
|
| 271 |
.demo-item span {
|
| 272 |
-
font-size: 0.
|
| 273 |
-
font-weight:
|
| 274 |
}
|
| 275 |
|
| 276 |
/* Main content layout */
|
| 277 |
.main-content-row {
|
| 278 |
display: flex;
|
| 279 |
-
gap:
|
| 280 |
width: 100%;
|
| 281 |
-
margin-bottom:
|
| 282 |
}
|
| 283 |
|
| 284 |
.upload-section {
|
| 285 |
flex: 2;
|
| 286 |
display: flex;
|
| 287 |
flex-direction: column;
|
| 288 |
-
gap:
|
| 289 |
}
|
| 290 |
|
| 291 |
.result-section {
|
|
@@ -294,7 +284,7 @@ def get_custom_css():
|
|
| 294 |
|
| 295 |
.upload-images-row {
|
| 296 |
display: flex;
|
| 297 |
-
gap:
|
| 298 |
width: 100%;
|
| 299 |
}
|
| 300 |
|
|
@@ -306,14 +296,13 @@ def get_custom_css():
|
|
| 306 |
.button-primary {
|
| 307 |
background: var(--button-primary-background-fill) !important;
|
| 308 |
border: none !important;
|
| 309 |
-
padding:
|
| 310 |
-
font-size:
|
| 311 |
font-weight: 600 !important;
|
| 312 |
color: var(--button-primary-text-color) !important;
|
| 313 |
-
border-radius:
|
| 314 |
cursor: pointer !important;
|
| 315 |
transition: background-color 0.2s ease !important;
|
| 316 |
-
margin: 15px 0 !important;
|
| 317 |
width: 100% !important;
|
| 318 |
}
|
| 319 |
|
|
@@ -324,8 +313,8 @@ def get_custom_css():
|
|
| 324 |
/* Result container styling */
|
| 325 |
.result-container {
|
| 326 |
background: var(--background-fill-primary);
|
| 327 |
-
padding:
|
| 328 |
-
border-radius:
|
| 329 |
margin-top: 0;
|
| 330 |
width: 100%;
|
| 331 |
text-align: center;
|
|
@@ -339,16 +328,16 @@ def get_custom_css():
|
|
| 339 |
/* Detection cards */
|
| 340 |
.detections-grid {
|
| 341 |
display: grid;
|
| 342 |
-
grid-template-columns: repeat(auto-fit, minmax(
|
| 343 |
-
gap:
|
| 344 |
-
margin-top:
|
| 345 |
justify-content: center;
|
| 346 |
}
|
| 347 |
|
| 348 |
.detection-card {
|
| 349 |
background: var(--background-fill-secondary);
|
| 350 |
-
padding:
|
| 351 |
-
border-radius:
|
| 352 |
text-align: center;
|
| 353 |
display: flex;
|
| 354 |
flex-direction: column;
|
|
@@ -356,32 +345,32 @@ def get_custom_css():
|
|
| 356 |
}
|
| 357 |
|
| 358 |
.face-thumbnail {
|
| 359 |
-
width:
|
| 360 |
-
height:
|
| 361 |
border-radius: 50%;
|
| 362 |
object-fit: cover;
|
| 363 |
-
margin-bottom:
|
| 364 |
}
|
| 365 |
|
| 366 |
.no-face {
|
| 367 |
-
width:
|
| 368 |
-
height:
|
| 369 |
background: var(--background-fill-primary);
|
| 370 |
border-radius: 50%;
|
| 371 |
display: flex;
|
| 372 |
align-items: center;
|
| 373 |
justify-content: center;
|
| 374 |
-
margin: 0 auto
|
| 375 |
color: var(--body-text-color);
|
| 376 |
-
font-size: 0.
|
| 377 |
opacity: 0.7;
|
| 378 |
}
|
| 379 |
|
| 380 |
.face-source {
|
| 381 |
-
font-size: 0.
|
| 382 |
color: var(--body-text-color);
|
| 383 |
opacity: 0.8;
|
| 384 |
-
margin-top:
|
| 385 |
}
|
| 386 |
|
| 387 |
/* Matching table - NEW STYLING */
|
|
@@ -395,26 +384,26 @@ def get_custom_css():
|
|
| 395 |
.matches-table table {
|
| 396 |
width: 100%;
|
| 397 |
border-collapse: collapse;
|
| 398 |
-
margin-top:
|
| 399 |
-
font-size:
|
| 400 |
-
min-width:
|
| 401 |
}
|
| 402 |
|
| 403 |
.matches-table th {
|
| 404 |
background: var(--background-fill-secondary);
|
| 405 |
color: var(--body-text-color);
|
| 406 |
-
padding:
|
| 407 |
text-align: center;
|
| 408 |
-
font-size:
|
| 409 |
-
font-weight:
|
| 410 |
border-bottom: 2px solid var(--border-color-primary);
|
| 411 |
}
|
| 412 |
|
| 413 |
.matches-table td {
|
| 414 |
-
padding:
|
| 415 |
border-bottom: 1px solid var(--border-color-primary);
|
| 416 |
text-align: center;
|
| 417 |
-
font-size: 0.
|
| 418 |
color: var(--body-text-color);
|
| 419 |
}
|
| 420 |
|
|
@@ -431,33 +420,35 @@ def get_custom_css():
|
|
| 431 |
display: flex;
|
| 432 |
flex-direction: column;
|
| 433 |
align-items: center;
|
| 434 |
-
gap:
|
| 435 |
}
|
| 436 |
|
| 437 |
.table-face-thumbnail {
|
| 438 |
-
width:
|
| 439 |
-
height:
|
| 440 |
border-radius: 50%;
|
| 441 |
object-fit: cover;
|
| 442 |
border: 2px solid var(--border-color-primary);
|
| 443 |
}
|
| 444 |
|
| 445 |
.face-label {
|
| 446 |
-
font-size: 0.
|
| 447 |
color: var(--body-text-color);
|
| 448 |
opacity: 1;
|
|
|
|
| 449 |
}
|
| 450 |
|
| 451 |
.similarity-score {
|
| 452 |
-
font-weight:
|
| 453 |
color: var(--body-text-color);
|
|
|
|
| 454 |
}
|
| 455 |
|
| 456 |
.result-text {
|
| 457 |
-
padding:
|
| 458 |
-
border-radius:
|
| 459 |
-
font-size: 1.
|
| 460 |
-
font-weight:
|
| 461 |
text-transform: capitalize;
|
| 462 |
}
|
| 463 |
|
|
@@ -473,21 +464,23 @@ def get_custom_css():
|
|
| 473 |
|
| 474 |
.no-results {
|
| 475 |
text-align: center;
|
| 476 |
-
padding:
|
| 477 |
color: var(--body-text-color);
|
| 478 |
opacity: 0.7;
|
| 479 |
font-style: italic;
|
|
|
|
| 480 |
}
|
| 481 |
|
| 482 |
/* Error messages */
|
| 483 |
.error-message {
|
| 484 |
background: var(--background-fill-secondary);
|
| 485 |
color: var(--body-text-color);
|
| 486 |
-
padding:
|
| 487 |
-
border-radius:
|
| 488 |
text-align: center;
|
| 489 |
width: 100%;
|
| 490 |
opacity: 0.9;
|
|
|
|
| 491 |
}
|
| 492 |
|
| 493 |
/* Input images styling */
|
|
@@ -495,7 +488,7 @@ def get_custom_css():
|
|
| 495 |
display: flex !important;
|
| 496 |
justify-content: center !important;
|
| 497 |
align-items: center !important;
|
| 498 |
-
height:
|
| 499 |
}
|
| 500 |
|
| 501 |
.gradio-image .wrap {
|
|
@@ -509,61 +502,62 @@ def get_custom_css():
|
|
| 509 |
/* Examples styling */
|
| 510 |
.examples-container {
|
| 511 |
background: var(--background-fill-secondary);
|
| 512 |
-
padding:
|
| 513 |
-
border-radius:
|
| 514 |
-
margin-top:
|
| 515 |
width: 100%;
|
| 516 |
text-align: center;
|
|
|
|
| 517 |
}
|
| 518 |
-
|
| 519 |
-
/* Footer */
|
| 520 |
-
.footer {
|
| 521 |
-
text-align: center;
|
| 522 |
-
margin-top: 20px;
|
| 523 |
-
padding: 15px;
|
| 524 |
-
border-radius: 6px;
|
| 525 |
-
background: var(--background-fill-secondary);
|
| 526 |
-
}
|
| 527 |
-
|
| 528 |
-
.footer p {
|
| 529 |
-
margin: 5px 0;
|
| 530 |
-
color: var(--body-text-color);
|
| 531 |
-
}
|
| 532 |
-
|
| 533 |
-
.footer a {
|
| 534 |
-
color: var(--body-text-color);
|
| 535 |
-
text-decoration: none;
|
| 536 |
-
opacity: 0.8;
|
| 537 |
-
}
|
| 538 |
-
|
| 539 |
-
.footer a:hover {
|
| 540 |
-
opacity: 1;
|
| 541 |
-
text-decoration: underline;
|
| 542 |
-
}
|
| 543 |
-
|
| 544 |
/* Section titles */
|
| 545 |
.section-title {
|
| 546 |
-
margin-bottom:
|
| 547 |
text-align: center;
|
| 548 |
color: var(--body-text-color);
|
| 549 |
-
font-weight:
|
|
|
|
| 550 |
}
|
| 551 |
|
| 552 |
/* Ensure proper text visibility in dark mode */
|
| 553 |
.gradio-markdown {
|
| 554 |
color: var(--body-text-color) !important;
|
|
|
|
|
|
|
| 555 |
}
|
| 556 |
|
| 557 |
.gradio-markdown h3 {
|
| 558 |
color: var(--body-text-color) !important;
|
|
|
|
| 559 |
}
|
| 560 |
|
| 561 |
.gradio-markdown p {
|
| 562 |
color: var(--body-text-color) !important;
|
|
|
|
|
|
|
| 563 |
}
|
| 564 |
|
| 565 |
.gradio-markdown li {
|
| 566 |
color: var(--body-text-color) !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 567 |
}
|
| 568 |
"""
|
| 569 |
|
|
@@ -664,7 +658,7 @@ with gr.Blocks(
|
|
| 664 |
with gr.Column(scale=1, elem_classes="upload-image-col"):
|
| 665 |
im_match_in1 = gr.Image(
|
| 666 |
type='filepath',
|
| 667 |
-
height=
|
| 668 |
label="First Image",
|
| 669 |
show_download_button=False
|
| 670 |
)
|
|
@@ -673,7 +667,7 @@ with gr.Blocks(
|
|
| 673 |
with gr.Column(scale=1, elem_classes="upload-image-col"):
|
| 674 |
im_match_in2 = gr.Image(
|
| 675 |
type='filepath',
|
| 676 |
-
height=
|
| 677 |
label="Second Image",
|
| 678 |
show_download_button=False
|
| 679 |
)
|
|
@@ -712,7 +706,7 @@ with gr.Blocks(
|
|
| 712 |
with gr.Column(scale=0.4, elem_classes="result-section"):
|
| 713 |
gr.Markdown("### 2. Comparison Results", elem_classes="section-title")
|
| 714 |
txt_compare_out = gr.HTML(
|
| 715 |
-
value="<div style='text-align: center; padding: 40px;'>Results will appear here after comparison</div>"
|
| 716 |
)
|
| 717 |
|
| 718 |
# Connect the function
|
|
@@ -728,9 +722,6 @@ with gr.Blocks(
|
|
| 728 |
<img src="https://api.visitorbadge.io/api/combined?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FMiniAiLive%2FFaceRecognition-LivenessDetection-Demo&label=VISITORS&labelColor=%2337d67a&countColor=%23ff8a65&style=plastic&labelStyle=none" />
|
| 729 |
</a>
|
| 730 |
""")
|
| 731 |
-
|
| 732 |
-
# Footer
|
| 733 |
-
gr.HTML(create_footer())
|
| 734 |
|
| 735 |
if __name__ == "__main__":
|
| 736 |
demo.launch(
|
|
|
|
| 137 |
html += "</div>"
|
| 138 |
return html
|
| 139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
def get_custom_css():
|
| 141 |
"""Return simplified CSS styling that works for both light and dark themes"""
|
| 142 |
return """
|
|
|
|
| 147 |
max-width: 95% !important;
|
| 148 |
width: 95% !important;
|
| 149 |
margin: 0 auto !important;
|
| 150 |
+
font-size: 16px !important;
|
| 151 |
}
|
| 152 |
|
| 153 |
/* Center everything */
|
|
|
|
| 162 |
/* Header styling - logo and text in same line */
|
| 163 |
.company-header {
|
| 164 |
background: var(--background-fill-primary);
|
| 165 |
+
padding: 25px;
|
| 166 |
+
margin-bottom: 25px;
|
| 167 |
text-align: center;
|
| 168 |
width: 100%;
|
| 169 |
display: flex;
|
| 170 |
align-items: center;
|
| 171 |
justify-content: center;
|
| 172 |
+
gap: 25px;
|
| 173 |
flex-wrap: wrap;
|
| 174 |
}
|
| 175 |
|
|
|
|
| 178 |
}
|
| 179 |
|
| 180 |
.header-logo img {
|
| 181 |
+
width: 140px;
|
| 182 |
height: auto;
|
| 183 |
}
|
| 184 |
|
|
|
|
| 187 |
}
|
| 188 |
|
| 189 |
.header-text h1 {
|
| 190 |
+
font-size: 2.4em !important;
|
| 191 |
+
margin-bottom: 12px;
|
| 192 |
+
font-weight: 700;
|
| 193 |
margin-top: 0;
|
| 194 |
color: var(--body-text-color);
|
| 195 |
}
|
| 196 |
|
| 197 |
.header-text p {
|
| 198 |
+
font-size: 1.3em !important;
|
| 199 |
margin-bottom: 0;
|
| 200 |
color: var(--body-text-color);
|
| 201 |
opacity: 0.8;
|
|
|
|
| 204 |
/* About section layout */
|
| 205 |
.about-section {
|
| 206 |
width: 100%;
|
| 207 |
+
margin-bottom: 25px;
|
| 208 |
}
|
| 209 |
|
| 210 |
.about-content {
|
| 211 |
display: flex;
|
| 212 |
+
gap: 25px;
|
| 213 |
width: 100%;
|
| 214 |
}
|
| 215 |
|
| 216 |
.features-section {
|
| 217 |
flex: 0.6;
|
| 218 |
+
padding: 25px;
|
| 219 |
background: var(--background-fill-secondary);
|
| 220 |
+
border-radius: 10px;
|
| 221 |
+
font-size: 1.05em !important;
|
| 222 |
}
|
| 223 |
|
| 224 |
.demo-items-section {
|
| 225 |
flex: 0.4;
|
| 226 |
+
padding: 10px;
|
| 227 |
background: var(--background-fill-secondary);
|
| 228 |
+
border-radius: 10px;
|
| 229 |
}
|
| 230 |
|
| 231 |
.demo-items-grid {
|
|
|
|
| 236 |
|
| 237 |
.demo-item {
|
| 238 |
background: var(--background-fill-primary);
|
| 239 |
+
padding: 5px;
|
| 240 |
+
border-radius: 8px;
|
| 241 |
text-align: center;
|
| 242 |
transition: background-color 0.2s ease;
|
| 243 |
display: flex;
|
|
|
|
| 246 |
justify-content: center;
|
| 247 |
text-decoration: none;
|
| 248 |
color: var(--body-text-color);
|
| 249 |
+
font-size: 1em !important;
|
| 250 |
}
|
| 251 |
|
| 252 |
.demo-item:hover {
|
|
|
|
| 254 |
}
|
| 255 |
|
| 256 |
.demo-item img {
|
| 257 |
+
height: 40px;
|
| 258 |
+
margin-bottom: 5px;
|
| 259 |
}
|
| 260 |
|
| 261 |
.demo-item span {
|
| 262 |
+
font-size: 0.95em !important;
|
| 263 |
+
font-weight: 600;
|
| 264 |
}
|
| 265 |
|
| 266 |
/* Main content layout */
|
| 267 |
.main-content-row {
|
| 268 |
display: flex;
|
| 269 |
+
gap: 25px;
|
| 270 |
width: 100%;
|
| 271 |
+
margin-bottom: 25px;
|
| 272 |
}
|
| 273 |
|
| 274 |
.upload-section {
|
| 275 |
flex: 2;
|
| 276 |
display: flex;
|
| 277 |
flex-direction: column;
|
| 278 |
+
gap: 20px;
|
| 279 |
}
|
| 280 |
|
| 281 |
.result-section {
|
|
|
|
| 284 |
|
| 285 |
.upload-images-row {
|
| 286 |
display: flex;
|
| 287 |
+
gap: 20px;
|
| 288 |
width: 100%;
|
| 289 |
}
|
| 290 |
|
|
|
|
| 296 |
.button-primary {
|
| 297 |
background: var(--button-primary-background-fill) !important;
|
| 298 |
border: none !important;
|
| 299 |
+
padding: 4px 8px !important;
|
| 300 |
+
font-size: 1.2em !important;
|
| 301 |
font-weight: 600 !important;
|
| 302 |
color: var(--button-primary-text-color) !important;
|
| 303 |
+
border-radius: 8px !important;
|
| 304 |
cursor: pointer !important;
|
| 305 |
transition: background-color 0.2s ease !important;
|
|
|
|
| 306 |
width: 100% !important;
|
| 307 |
}
|
| 308 |
|
|
|
|
| 313 |
/* Result container styling */
|
| 314 |
.result-container {
|
| 315 |
background: var(--background-fill-primary);
|
| 316 |
+
padding: 8px;
|
| 317 |
+
border-radius: 10px;
|
| 318 |
margin-top: 0;
|
| 319 |
width: 100%;
|
| 320 |
text-align: center;
|
|
|
|
| 328 |
/* Detection cards */
|
| 329 |
.detections-grid {
|
| 330 |
display: grid;
|
| 331 |
+
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
| 332 |
+
gap: 15px;
|
| 333 |
+
margin-top: 20px;
|
| 334 |
justify-content: center;
|
| 335 |
}
|
| 336 |
|
| 337 |
.detection-card {
|
| 338 |
background: var(--background-fill-secondary);
|
| 339 |
+
padding: 15px;
|
| 340 |
+
border-radius: 8px;
|
| 341 |
text-align: center;
|
| 342 |
display: flex;
|
| 343 |
flex-direction: column;
|
|
|
|
| 345 |
}
|
| 346 |
|
| 347 |
.face-thumbnail {
|
| 348 |
+
width: 60px;
|
| 349 |
+
height: 60px;
|
| 350 |
border-radius: 50%;
|
| 351 |
object-fit: cover;
|
| 352 |
+
margin-bottom: 10px;
|
| 353 |
}
|
| 354 |
|
| 355 |
.no-face {
|
| 356 |
+
width: 60px;
|
| 357 |
+
height: 60px;
|
| 358 |
background: var(--background-fill-primary);
|
| 359 |
border-radius: 50%;
|
| 360 |
display: flex;
|
| 361 |
align-items: center;
|
| 362 |
justify-content: center;
|
| 363 |
+
margin: 0 auto 10px;
|
| 364 |
color: var(--body-text-color);
|
| 365 |
+
font-size: 0.8em;
|
| 366 |
opacity: 0.7;
|
| 367 |
}
|
| 368 |
|
| 369 |
.face-source {
|
| 370 |
+
font-size: 0.9em !important;
|
| 371 |
color: var(--body-text-color);
|
| 372 |
opacity: 0.8;
|
| 373 |
+
margin-top: 8px;
|
| 374 |
}
|
| 375 |
|
| 376 |
/* Matching table - NEW STYLING */
|
|
|
|
| 384 |
.matches-table table {
|
| 385 |
width: 100%;
|
| 386 |
border-collapse: collapse;
|
| 387 |
+
margin-top: 8px;
|
| 388 |
+
font-size: 1em !important;
|
| 389 |
+
min-width: 550px;
|
| 390 |
}
|
| 391 |
|
| 392 |
.matches-table th {
|
| 393 |
background: var(--background-fill-secondary);
|
| 394 |
color: var(--body-text-color);
|
| 395 |
+
padding: 12px 8px !important;
|
| 396 |
text-align: center;
|
| 397 |
+
font-size: 1em !important;
|
| 398 |
+
font-weight: 700;
|
| 399 |
border-bottom: 2px solid var(--border-color-primary);
|
| 400 |
}
|
| 401 |
|
| 402 |
.matches-table td {
|
| 403 |
+
padding: 10px 8px !important;
|
| 404 |
border-bottom: 1px solid var(--border-color-primary);
|
| 405 |
text-align: center;
|
| 406 |
+
font-size: 0.95em !important;
|
| 407 |
color: var(--body-text-color);
|
| 408 |
}
|
| 409 |
|
|
|
|
| 420 |
display: flex;
|
| 421 |
flex-direction: column;
|
| 422 |
align-items: center;
|
| 423 |
+
gap: 5px;
|
| 424 |
}
|
| 425 |
|
| 426 |
.table-face-thumbnail {
|
| 427 |
+
width: 70px;
|
| 428 |
+
height: 70px;
|
| 429 |
border-radius: 50%;
|
| 430 |
object-fit: cover;
|
| 431 |
border: 2px solid var(--border-color-primary);
|
| 432 |
}
|
| 433 |
|
| 434 |
.face-label {
|
| 435 |
+
font-size: 0.9em !important;
|
| 436 |
color: var(--body-text-color);
|
| 437 |
opacity: 1;
|
| 438 |
+
font-weight: 600;
|
| 439 |
}
|
| 440 |
|
| 441 |
.similarity-score {
|
| 442 |
+
font-weight: 700;
|
| 443 |
color: var(--body-text-color);
|
| 444 |
+
font-size: 1.05em !important;
|
| 445 |
}
|
| 446 |
|
| 447 |
.result-text {
|
| 448 |
+
padding: 8px 12px !important;
|
| 449 |
+
border-radius: 12px;
|
| 450 |
+
font-size: 1.1em !important;
|
| 451 |
+
font-weight: 700;
|
| 452 |
text-transform: capitalize;
|
| 453 |
}
|
| 454 |
|
|
|
|
| 464 |
|
| 465 |
.no-results {
|
| 466 |
text-align: center;
|
| 467 |
+
padding: 40px;
|
| 468 |
color: var(--body-text-color);
|
| 469 |
opacity: 0.7;
|
| 470 |
font-style: italic;
|
| 471 |
+
font-size: 1.1em !important;
|
| 472 |
}
|
| 473 |
|
| 474 |
/* Error messages */
|
| 475 |
.error-message {
|
| 476 |
background: var(--background-fill-secondary);
|
| 477 |
color: var(--body-text-color);
|
| 478 |
+
padding: 20px;
|
| 479 |
+
border-radius: 8px;
|
| 480 |
text-align: center;
|
| 481 |
width: 100%;
|
| 482 |
opacity: 0.9;
|
| 483 |
+
font-size: 1.1em !important;
|
| 484 |
}
|
| 485 |
|
| 486 |
/* Input images styling */
|
|
|
|
| 488 |
display: flex !important;
|
| 489 |
justify-content: center !important;
|
| 490 |
align-items: center !important;
|
| 491 |
+
height: 320px !important;
|
| 492 |
}
|
| 493 |
|
| 494 |
.gradio-image .wrap {
|
|
|
|
| 502 |
/* Examples styling */
|
| 503 |
.examples-container {
|
| 504 |
background: var(--background-fill-secondary);
|
| 505 |
+
padding: 15px;
|
| 506 |
+
border-radius: 8px;
|
| 507 |
+
margin-top: 15px;
|
| 508 |
width: 100%;
|
| 509 |
text-align: center;
|
| 510 |
+
font-size: 1em !important;
|
| 511 |
}
|
| 512 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 513 |
/* Section titles */
|
| 514 |
.section-title {
|
| 515 |
+
margin-bottom: 15px !important;
|
| 516 |
text-align: center;
|
| 517 |
color: var(--body-text-color);
|
| 518 |
+
font-weight: 700;
|
| 519 |
+
font-size: 1.4em !important;
|
| 520 |
}
|
| 521 |
|
| 522 |
/* Ensure proper text visibility in dark mode */
|
| 523 |
.gradio-markdown {
|
| 524 |
color: var(--body-text-color) !important;
|
| 525 |
+
font-size: 1.05em !important;
|
| 526 |
+
line-height: 1.5 !important;
|
| 527 |
}
|
| 528 |
|
| 529 |
.gradio-markdown h3 {
|
| 530 |
color: var(--body-text-color) !important;
|
| 531 |
+
font-size: 1.3em !important;
|
| 532 |
}
|
| 533 |
|
| 534 |
.gradio-markdown p {
|
| 535 |
color: var(--body-text-color) !important;
|
| 536 |
+
font-size: 1.05em !important;
|
| 537 |
+
line-height: 1.5 !important;
|
| 538 |
}
|
| 539 |
|
| 540 |
.gradio-markdown li {
|
| 541 |
color: var(--body-text-color) !important;
|
| 542 |
+
font-size: 1.05em !important;
|
| 543 |
+
line-height: 1.5 !important;
|
| 544 |
+
margin-bottom: 8px !important;
|
| 545 |
+
}
|
| 546 |
+
|
| 547 |
+
/* Label styling */
|
| 548 |
+
.gr-label {
|
| 549 |
+
font-size: 1.1em !important;
|
| 550 |
+
font-weight: 600 !important;
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
/* Accordion styling */
|
| 554 |
+
.gr-accordion {
|
| 555 |
+
font-size: 1.1em !important;
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
/* Examples text */
|
| 559 |
+
.gr-examples {
|
| 560 |
+
font-size: 1em !important;
|
| 561 |
}
|
| 562 |
"""
|
| 563 |
|
|
|
|
| 658 |
with gr.Column(scale=1, elem_classes="upload-image-col"):
|
| 659 |
im_match_in1 = gr.Image(
|
| 660 |
type='filepath',
|
| 661 |
+
height=320,
|
| 662 |
label="First Image",
|
| 663 |
show_download_button=False
|
| 664 |
)
|
|
|
|
| 667 |
with gr.Column(scale=1, elem_classes="upload-image-col"):
|
| 668 |
im_match_in2 = gr.Image(
|
| 669 |
type='filepath',
|
| 670 |
+
height=320,
|
| 671 |
label="Second Image",
|
| 672 |
show_download_button=False
|
| 673 |
)
|
|
|
|
| 706 |
with gr.Column(scale=0.4, elem_classes="result-section"):
|
| 707 |
gr.Markdown("### 2. Comparison Results", elem_classes="section-title")
|
| 708 |
txt_compare_out = gr.HTML(
|
| 709 |
+
value="<div style='text-align: center; padding: 40px; font-size: 1.1em;'>Results will appear here after comparison</div>"
|
| 710 |
)
|
| 711 |
|
| 712 |
# Connect the function
|
|
|
|
| 722 |
<img src="https://api.visitorbadge.io/api/combined?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FMiniAiLive%2FFaceRecognition-LivenessDetection-Demo&label=VISITORS&labelColor=%2337d67a&countColor=%23ff8a65&style=plastic&labelStyle=none" />
|
| 723 |
</a>
|
| 724 |
""")
|
|
|
|
|
|
|
|
|
|
| 725 |
|
| 726 |
if __name__ == "__main__":
|
| 727 |
demo.launch(
|