Update app.py
Browse files
app.py
CHANGED
|
@@ -137,6 +137,19 @@ def format_face_comparison_result(result, img1_path, img2_path):
|
|
| 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 """
|
|
@@ -231,12 +244,12 @@ def get_custom_css():
|
|
| 231 |
.demo-items-grid {
|
| 232 |
display: grid;
|
| 233 |
grid-template-columns: repeat(2, 1fr);
|
| 234 |
-
gap:
|
| 235 |
}
|
| 236 |
|
| 237 |
.demo-item {
|
| 238 |
background: var(--background-fill-primary);
|
| 239 |
-
padding:
|
| 240 |
border-radius: 8px;
|
| 241 |
text-align: center;
|
| 242 |
transition: background-color 0.2s ease;
|
|
@@ -254,8 +267,8 @@ def get_custom_css():
|
|
| 254 |
}
|
| 255 |
|
| 256 |
.demo-item img {
|
| 257 |
-
height:
|
| 258 |
-
margin-bottom:
|
| 259 |
}
|
| 260 |
|
| 261 |
.demo-item span {
|
|
@@ -296,13 +309,14 @@ def get_custom_css():
|
|
| 296 |
.button-primary {
|
| 297 |
background: var(--button-primary-background-fill) !important;
|
| 298 |
border: none !important;
|
| 299 |
-
padding:
|
| 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 |
|
|
@@ -488,7 +502,7 @@ def get_custom_css():
|
|
| 488 |
display: flex !important;
|
| 489 |
justify-content: center !important;
|
| 490 |
align-items: center !important;
|
| 491 |
-
height:
|
| 492 |
}
|
| 493 |
|
| 494 |
.gradio-image .wrap {
|
|
@@ -509,7 +523,35 @@ def get_custom_css():
|
|
| 509 |
text-align: center;
|
| 510 |
font-size: 1em !important;
|
| 511 |
}
|
| 512 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 513 |
/* Section titles */
|
| 514 |
.section-title {
|
| 515 |
margin-bottom: 15px !important;
|
|
@@ -658,7 +700,7 @@ with gr.Blocks(
|
|
| 658 |
with gr.Column(scale=1, elem_classes="upload-image-col"):
|
| 659 |
im_match_in1 = gr.Image(
|
| 660 |
type='filepath',
|
| 661 |
-
height=
|
| 662 |
label="First Image",
|
| 663 |
show_download_button=False
|
| 664 |
)
|
|
@@ -667,7 +709,7 @@ with gr.Blocks(
|
|
| 667 |
with gr.Column(scale=1, elem_classes="upload-image-col"):
|
| 668 |
im_match_in2 = gr.Image(
|
| 669 |
type='filepath',
|
| 670 |
-
height=
|
| 671 |
label="Second Image",
|
| 672 |
show_download_button=False
|
| 673 |
)
|
|
@@ -722,6 +764,9 @@ with gr.Blocks(
|
|
| 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(
|
|
|
|
| 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 """
|
|
|
|
| 244 |
.demo-items-grid {
|
| 245 |
display: grid;
|
| 246 |
grid-template-columns: repeat(2, 1fr);
|
| 247 |
+
gap: 15px;
|
| 248 |
}
|
| 249 |
|
| 250 |
.demo-item {
|
| 251 |
background: var(--background-fill-primary);
|
| 252 |
+
padding: 4px;
|
| 253 |
border-radius: 8px;
|
| 254 |
text-align: center;
|
| 255 |
transition: background-color 0.2s ease;
|
|
|
|
| 267 |
}
|
| 268 |
|
| 269 |
.demo-item img {
|
| 270 |
+
height: 30px;
|
| 271 |
+
margin-bottom: 10px;
|
| 272 |
}
|
| 273 |
|
| 274 |
.demo-item span {
|
|
|
|
| 309 |
.button-primary {
|
| 310 |
background: var(--button-primary-background-fill) !important;
|
| 311 |
border: none !important;
|
| 312 |
+
padding: 16px 32px !important;
|
| 313 |
font-size: 1.2em !important;
|
| 314 |
font-weight: 600 !important;
|
| 315 |
color: var(--button-primary-text-color) !important;
|
| 316 |
border-radius: 8px !important;
|
| 317 |
cursor: pointer !important;
|
| 318 |
transition: background-color 0.2s ease !important;
|
| 319 |
+
margin: 20px 0 !important;
|
| 320 |
width: 100% !important;
|
| 321 |
}
|
| 322 |
|
|
|
|
| 502 |
display: flex !important;
|
| 503 |
justify-content: center !important;
|
| 504 |
align-items: center !important;
|
| 505 |
+
height: 380px !important;
|
| 506 |
}
|
| 507 |
|
| 508 |
.gradio-image .wrap {
|
|
|
|
| 523 |
text-align: center;
|
| 524 |
font-size: 1em !important;
|
| 525 |
}
|
| 526 |
+
|
| 527 |
+
/* Footer */
|
| 528 |
+
.footer {
|
| 529 |
+
text-align: center;
|
| 530 |
+
margin-top: 25px;
|
| 531 |
+
padding: 20px;
|
| 532 |
+
border-radius: 8px;
|
| 533 |
+
background: var(--background-fill-secondary);
|
| 534 |
+
font-size: 1em !important;
|
| 535 |
+
}
|
| 536 |
+
|
| 537 |
+
.footer p {
|
| 538 |
+
margin: 8px 0;
|
| 539 |
+
color: var(--body-text-color);
|
| 540 |
+
font-size: 1.05em !important;
|
| 541 |
+
}
|
| 542 |
+
|
| 543 |
+
.footer a {
|
| 544 |
+
color: var(--body-text-color);
|
| 545 |
+
text-decoration: none;
|
| 546 |
+
opacity: 0.8;
|
| 547 |
+
font-size: 1.05em !important;
|
| 548 |
+
}
|
| 549 |
+
|
| 550 |
+
.footer a:hover {
|
| 551 |
+
opacity: 1;
|
| 552 |
+
text-decoration: underline;
|
| 553 |
+
}
|
| 554 |
+
|
| 555 |
/* Section titles */
|
| 556 |
.section-title {
|
| 557 |
margin-bottom: 15px !important;
|
|
|
|
| 700 |
with gr.Column(scale=1, elem_classes="upload-image-col"):
|
| 701 |
im_match_in1 = gr.Image(
|
| 702 |
type='filepath',
|
| 703 |
+
height=380,
|
| 704 |
label="First Image",
|
| 705 |
show_download_button=False
|
| 706 |
)
|
|
|
|
| 709 |
with gr.Column(scale=1, elem_classes="upload-image-col"):
|
| 710 |
im_match_in2 = gr.Image(
|
| 711 |
type='filepath',
|
| 712 |
+
height=380,
|
| 713 |
label="Second Image",
|
| 714 |
show_download_button=False
|
| 715 |
)
|
|
|
|
| 764 |
<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" />
|
| 765 |
</a>
|
| 766 |
""")
|
| 767 |
+
|
| 768 |
+
# Footer
|
| 769 |
+
gr.HTML(create_footer())
|
| 770 |
|
| 771 |
if __name__ == "__main__":
|
| 772 |
demo.launch(
|