Yao211 commited on
Commit
055c27b
·
verified ·
1 Parent(s): 73a884a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -201
app.py CHANGED
@@ -15,9 +15,9 @@ def face_compare(frame1, frame2, request: gr.Request = None):
15
  # Prepare files
16
  files = {}
17
  if frame1:
18
- files['image1'] = open(frame1, 'rb')
19
  if frame2:
20
- files['image2'] = open(frame2, 'rb')
21
 
22
  if not files:
23
  return "<div class='error-message'>Please upload both images</div>"
@@ -137,32 +137,12 @@ 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 """
156
  footer {visibility: hidden}
157
-
158
- /* Full width container */
159
- .gradio-container {
160
- max-width: 95% !important;
161
- width: 95% !important;
162
- margin: 0 auto !important;
163
- font-size: 16px !important;
164
- }
165
-
166
  /* Center everything */
167
  .container {
168
  display: flex;
@@ -191,7 +171,7 @@ def get_custom_css():
191
  }
192
 
193
  .header-logo img {
194
- width: 140px;
195
  height: auto;
196
  }
197
 
@@ -497,116 +477,11 @@ def get_custom_css():
497
  font-size: 1.1em !important;
498
  }
499
 
500
- /* Input images styling */
501
- .gradio-image {
502
- display: flex !important;
503
- justify-content: center !important;
504
- align-items: center !important;
505
- height: 380px !important;
506
- }
507
-
508
- .gradio-image .wrap {
509
- display: flex !important;
510
- justify-content: center !important;
511
- align-items: center !important;
512
- width: 100% !important;
513
- height: 100% !important;
514
- }
515
-
516
- /* Examples styling */
517
- .examples-container {
518
- background: var(--background-fill-secondary);
519
- padding: 15px;
520
- border-radius: 8px;
521
- margin-top: 15px;
522
- width: 100%;
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;
558
- text-align: center;
559
- color: var(--body-text-color);
560
- font-weight: 700;
561
- font-size: 1.4em !important;
562
- }
563
-
564
- /* Ensure proper text visibility in dark mode */
565
- .gradio-markdown {
566
- color: var(--body-text-color) !important;
567
- font-size: 1.05em !important;
568
- line-height: 1.5 !important;
569
- }
570
-
571
- .gradio-markdown h3 {
572
- color: var(--body-text-color) !important;
573
- font-size: 1.3em !important;
574
- }
575
-
576
- .gradio-markdown p {
577
- color: var(--body-text-color) !important;
578
- font-size: 1.05em !important;
579
- line-height: 1.5 !important;
580
- }
581
-
582
- .gradio-markdown li {
583
- color: var(--body-text-color) !important;
584
- font-size: 1.05em !important;
585
- line-height: 1.5 !important;
586
- margin-bottom: 8px !important;
587
- }
588
-
589
- /* Label styling */
590
- .gr-label {
591
- font-size: 1.1em !important;
592
- font-weight: 600 !important;
593
- }
594
-
595
- /* Accordion styling */
596
- .gr-accordion {
597
- font-size: 1.1em !important;
598
- }
599
-
600
- /* Examples text */
601
- .gr-examples {
602
- font-size: 1em !important;
603
- }
604
  """
605
 
606
  # Create Gradio interface
607
  with gr.Blocks(
608
  title="MiniAiLive - Face Recognition WebAPI Playground",
609
- theme=gr.themes.Glass(),
610
  css=get_custom_css()
611
  ) as demo:
612
 
@@ -615,7 +490,7 @@ with gr.Blocks(
615
  gr.HTML("""
616
  <div class="company-header">
617
  <div class="header-logo">
618
- <img src="https://miniai.live/wp-content/uploads/2024/02/logo_name-1-768x426-1.png" alt="MiniAiLive Logo">
619
  </div>
620
  <div class="header-text">
621
  <h1>MiniAiLive Face Recognition WebAPI Playground</h1>
@@ -624,77 +499,10 @@ with gr.Blocks(
624
  </div>
625
  """)
626
 
627
- # About Section with Features and Demo Items
628
- with gr.Column(elem_classes="about-section"):
629
- with gr.Row(elem_classes="about-content"):
630
- # Features Section (60%)
631
- with gr.Column(scale=0.6, elem_classes="features-section"):
632
- gr.Markdown("""
633
- **MiniAiLive** is a leading provider of cutting-edge face recognition and liveness detection solutions.
634
- Our technology is **NIST FRVT Top Ranked** for Face Recognition.
635
-
636
- ### 🏆 Key Features:
637
- - **NIST FRVT Top Ranked** Top Accuracy in both 1:1 & 1:N Face Matching Technology
638
- - **Real-time** Face Matching & Verification
639
- - **On-Premise** Offers complete data control and privacy
640
- - **On-Device, Offline** Runs on machine. No internet connection is required.
641
- - **Cross-Platform Support** Supports Windows, Linux, Android & iOS
642
- - **Free Service** Completely free to use, Free technical support & update
643
-
644
- [Visit our website](https://miniai.live) to explore our complete suite of AI solutions!
645
- """)
646
-
647
- # Demo Items Section (40%)
648
- with gr.Column(scale=0.4, elem_classes="demo-items-section"):
649
- with gr.Column(elem_classes="demo-items-grid"):
650
- gr.HTML("""
651
- <a href="https://github.com/MiniAiLive" target="_blank" class="demo-item">
652
- <img src="https://miniai.live/wp-content/uploads/2024/10/new_git-1-300x67.png" alt="GitHub">
653
- <span>GitHub</span>
654
- </a>
655
- """)
656
-
657
- gr.HTML("""
658
- <a href="https://huggingface.co/MiniAiLive" target="_blank" class="demo-item">
659
- <img src="https://miniai.live/wp-content/uploads/2024/10/new_hugging-1-300x67.png" alt="HuggingFace">
660
- <span>HuggingFace</span>
661
- </a>
662
- """)
663
-
664
- gr.HTML("""
665
- <a href="https://demo.miniai.live" target="_blank" class="demo-item">
666
- <img src="https://miniai.live/wp-content/uploads/2024/10/new_gradio-300x67.png" alt="Gradio">
667
- <span>Live Demo</span>
668
- </a>
669
- """)
670
-
671
- gr.HTML("""
672
- <a href="https://docs.miniai.live/" target="_blank" class="demo-item">
673
- <img src="https://miniai.live/wp-content/uploads/2024/10/a-300x70.png" alt="Documentation">
674
- <span>Documentation</span>
675
- </a>
676
- """)
677
-
678
- gr.HTML("""
679
- <a href="https://www.youtube.com/@miniailive" target="_blank" class="demo-item">
680
- <img src="https://miniai.live/wp-content/uploads/2024/10/Untitled-1-300x70.png" alt="YouTube">
681
- <span>YouTube</span>
682
- </a>
683
- """)
684
-
685
- gr.HTML("""
686
- <a href="https://play.google.com/store/apps/dev?id=5831076207730531667" target="_blank" class="demo-item">
687
- <img src="https://miniai.live/wp-content/uploads/2024/10/googleplay-300x62.png" alt="Google Play">
688
- <span>Google Play</span>
689
- </a>
690
- """)
691
-
692
  # Main Content - Upload and Results
693
  with gr.Row(elem_classes="main-content-row"):
694
  # Upload Section
695
  with gr.Column(scale=0.6, elem_classes="upload-section"):
696
- gr.Markdown("### 1. Upload Images for Comparison", elem_classes="section-title")
697
-
698
  with gr.Row(elem_classes="upload-images-row"):
699
  # First Image
700
  with gr.Column(scale=1, elem_classes="upload-image-col"):
@@ -742,7 +550,6 @@ with gr.Blocks(
742
 
743
  # Results Section
744
  with gr.Column(scale=0.4, elem_classes="result-section"):
745
- gr.Markdown("### 2. Comparison Results", elem_classes="section-title")
746
  txt_compare_out = gr.HTML(
747
  value="<div style='text-align: center; padding: 40px; font-size: 1.1em;'>Results will appear here after comparison</div>"
748
  )
@@ -753,9 +560,6 @@ with gr.Blocks(
753
  inputs=[im_match_in1, im_match_in2],
754
  outputs=txt_compare_out
755
  )
756
-
757
- # Footer
758
- gr.HTML(create_footer())
759
 
760
  if __name__ == "__main__":
761
  demo.launch(
 
15
  # Prepare files
16
  files = {}
17
  if frame1:
18
+ files['file1'] = open(frame1, 'rb')
19
  if frame2:
20
+ files['file2'] = open(frame2, 'rb')
21
 
22
  if not files:
23
  return "<div class='error-message'>Please upload both images</div>"
 
137
  html += "</div>"
138
  return html
139
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
141
  def get_custom_css():
142
  """Return simplified CSS styling that works for both light and dark themes"""
143
  return """
144
  footer {visibility: hidden}
145
+
 
 
 
 
 
 
 
 
146
  /* Center everything */
147
  .container {
148
  display: flex;
 
171
  }
172
 
173
  .header-logo img {
174
+ width: 80px;
175
  height: auto;
176
  }
177
 
 
477
  font-size: 1.1em !important;
478
  }
479
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
480
  """
481
 
482
  # Create Gradio interface
483
  with gr.Blocks(
484
  title="MiniAiLive - Face Recognition WebAPI Playground",
 
485
  css=get_custom_css()
486
  ) as demo:
487
 
 
490
  gr.HTML("""
491
  <div class="company-header">
492
  <div class="header-logo">
493
+ <img src="https://miniai.live/wp-content/uploads/2025/11/logo_new.png" alt="MiniAiLive Logo">
494
  </div>
495
  <div class="header-text">
496
  <h1>MiniAiLive Face Recognition WebAPI Playground</h1>
 
499
  </div>
500
  """)
501
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
502
  # Main Content - Upload and Results
503
  with gr.Row(elem_classes="main-content-row"):
504
  # Upload Section
505
  with gr.Column(scale=0.6, elem_classes="upload-section"):
 
 
506
  with gr.Row(elem_classes="upload-images-row"):
507
  # First Image
508
  with gr.Column(scale=1, elem_classes="upload-image-col"):
 
550
 
551
  # Results Section
552
  with gr.Column(scale=0.4, elem_classes="result-section"):
 
553
  txt_compare_out = gr.HTML(
554
  value="<div style='text-align: center; padding: 40px; font-size: 1.1em;'>Results will appear here after comparison</div>"
555
  )
 
560
  inputs=[im_match_in1, im_match_in2],
561
  outputs=txt_compare_out
562
  )
 
 
 
563
 
564
  if __name__ == "__main__":
565
  demo.launch(