Update app.py
Browse files
app.py
CHANGED
|
@@ -604,55 +604,150 @@ def pick_quickstarts(df, n=3):
|
|
| 604 |
# =============================================================================
|
| 605 |
|
| 606 |
CUSTOM_CSS = """
|
| 607 |
-
@import url('https://fonts.googleapis.com/css2?family=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 608 |
|
| 609 |
-
.fs-
|
| 610 |
-
|
| 611 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 612 |
|
| 613 |
-
.fs-placeholder {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 614 |
|
| 615 |
-
.fs-profile-card {
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
| 620 |
-
|
| 621 |
-
.fs-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 622 |
|
| 623 |
-
.fs-header {
|
| 624 |
-
|
| 625 |
-
|
| 626 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 627 |
|
| 628 |
-
.fs-note {
|
| 629 |
-
|
| 630 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 631 |
|
| 632 |
-
.fs-grid { display:grid; grid-template-columns: repeat(3, 1fr); gap:
|
| 633 |
@media (max-width: 900px) { .fs-grid { grid-template-columns: 1fr; } }
|
| 634 |
|
| 635 |
-
.fs-look-card {
|
| 636 |
-
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
.fs-look-
|
| 640 |
-
|
| 641 |
-
|
| 642 |
-
|
| 643 |
-
.fs-
|
| 644 |
-
|
| 645 |
-
|
| 646 |
-
|
| 647 |
-
|
| 648 |
-
.fs-
|
| 649 |
-
|
| 650 |
-
|
| 651 |
-
|
| 652 |
-
|
| 653 |
-
|
| 654 |
-
.fs-
|
| 655 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 656 |
"""
|
| 657 |
|
| 658 |
|
|
@@ -780,13 +875,49 @@ def build_demo(df, model, processor, faiss_index, device):
|
|
| 780 |
return gr.update(visible=is_photo), gr.update(visible=not is_photo)
|
| 781 |
|
| 782 |
theme = gr.themes.Soft(
|
| 783 |
-
primary_hue=gr.themes.colors.
|
| 784 |
-
secondary_hue=gr.themes.colors.
|
| 785 |
-
neutral_hue=gr.themes.colors.
|
|
|
|
|
|
|
| 786 |
).set(
|
| 787 |
-
|
| 788 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 789 |
button_primary_text_color="#FFFFFF",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 790 |
)
|
| 791 |
|
| 792 |
with gr.Blocks(css=CUSTOM_CSS, theme=theme, title="Personal Style Matcher") as demo:
|
|
|
|
| 604 |
# =============================================================================
|
| 605 |
|
| 606 |
CUSTOM_CSS = """
|
| 607 |
+
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@200;300;400;500;600;700&family=Inter:wght@400;500;600&display=swap');
|
| 608 |
+
|
| 609 |
+
.fs-root {
|
| 610 |
+
--cream: #FDFBF7;
|
| 611 |
+
--white: #FFFFFF;
|
| 612 |
+
--charcoal: #1A1A1A;
|
| 613 |
+
--charcoal-soft: #3A3A3A;
|
| 614 |
+
--text-muted: #948D80;
|
| 615 |
+
--hairline: #EEEEEE;
|
| 616 |
+
--rose: #C48793;
|
| 617 |
+
--rose-soft: #F6ECEE;
|
| 618 |
+
--sage: #9CAF88;
|
| 619 |
+
--sage-soft: #EFF3EA;
|
| 620 |
+
--gold: #C9A876;
|
| 621 |
+
--gold-soft: #F8F1E4;
|
| 622 |
+
max-width: 1120px;
|
| 623 |
+
margin: 0 auto;
|
| 624 |
+
font-family: 'Inter', system-ui, sans-serif;
|
| 625 |
+
color: var(--charcoal-soft);
|
| 626 |
+
}
|
| 627 |
|
| 628 |
+
.fs-app-title {
|
| 629 |
+
font-family: 'Montserrat', system-ui, sans-serif;
|
| 630 |
+
font-weight: 600;
|
| 631 |
+
font-size: 30px;
|
| 632 |
+
letter-spacing: 0.02em;
|
| 633 |
+
color: var(--charcoal);
|
| 634 |
+
margin-bottom: 4px;
|
| 635 |
+
}
|
| 636 |
+
.fs-app-tag { color: var(--text-muted); font-size: 14px; letter-spacing: 0.01em; margin-bottom: 6px; }
|
| 637 |
|
| 638 |
+
.fs-placeholder {
|
| 639 |
+
color: var(--text-muted); font-size: 14px; padding: 48px 24px; text-align: center;
|
| 640 |
+
border: 1px solid var(--hairline); border-radius: 25px; background: var(--white);
|
| 641 |
+
letter-spacing: 0.01em;
|
| 642 |
+
}
|
| 643 |
|
| 644 |
+
.fs-profile-card {
|
| 645 |
+
background: linear-gradient(135deg, var(--rose-soft) 0%, var(--sage-soft) 100%);
|
| 646 |
+
border: 1px solid var(--hairline); border-radius: 25px; padding: 32px 34px;
|
| 647 |
+
margin-bottom: 24px; position: relative; overflow: hidden;
|
| 648 |
+
box-shadow: 0px 10px 30px rgba(0,0,0,0.05);
|
| 649 |
+
}
|
| 650 |
+
.fs-profile-eyebrow {
|
| 651 |
+
color: var(--rose); font-weight: 600; font-size: 12px; letter-spacing: .16em;
|
| 652 |
+
text-transform: uppercase; margin-bottom: 10px;
|
| 653 |
+
}
|
| 654 |
+
.fs-profile-season {
|
| 655 |
+
font-family: 'Montserrat', sans-serif; font-weight: 300; font-size: 30px;
|
| 656 |
+
letter-spacing: 0.01em; color: var(--charcoal); margin-bottom: 10px;
|
| 657 |
+
}
|
| 658 |
+
.fs-profile-blurb { color: var(--charcoal-soft); font-size: 14.5px; max-width: 620px; margin-bottom: 20px; line-height: 1.6; }
|
| 659 |
+
.fs-chip-row { display: flex; gap: 10px; flex-wrap: wrap; }
|
| 660 |
+
.fs-chip {
|
| 661 |
+
display: flex; align-items: center; gap: 8px; background: var(--white);
|
| 662 |
+
border: 1px solid var(--hairline); border-radius: 999px; padding: 7px 14px 7px 7px;
|
| 663 |
+
font-size: 12px; color: var(--charcoal-soft); letter-spacing: 0.02em;
|
| 664 |
+
box-shadow: 0px 4px 10px rgba(0,0,0,0.03);
|
| 665 |
+
}
|
| 666 |
+
.fs-chip-dot { width: 18px; height: 18px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 2px var(--white), 0 1px 4px rgba(0,0,0,.15); }
|
| 667 |
|
| 668 |
+
.fs-header {
|
| 669 |
+
position: relative; background: var(--white); border: 1px solid var(--hairline);
|
| 670 |
+
border-radius: 25px; padding: 30px 34px; margin-bottom: 24px; overflow: hidden;
|
| 671 |
+
box-shadow: 0px 10px 30px rgba(0,0,0,0.04);
|
| 672 |
+
}
|
| 673 |
+
.fs-header-decoration {
|
| 674 |
+
position: absolute; top: -50px; right: -40px; width: 160px; height: 160px;
|
| 675 |
+
border-radius: 50%; background: radial-gradient(circle, var(--gold-soft) 0%, transparent 70%);
|
| 676 |
+
}
|
| 677 |
+
.fs-header-eyebrow {
|
| 678 |
+
color: var(--rose); font-weight: 600; font-size: 13px; letter-spacing: .18em;
|
| 679 |
+
text-transform: uppercase; margin-bottom: 8px; position: relative; z-index: 1;
|
| 680 |
+
}
|
| 681 |
+
.fs-header-sub { font-size: 15.5px; color: var(--text-muted); letter-spacing: 0.01em; position: relative; z-index: 1; }
|
| 682 |
|
| 683 |
+
.fs-note {
|
| 684 |
+
background: var(--gold-soft); color: #7a5c34; border: 1px solid #EADFC4; border-radius: 14px;
|
| 685 |
+
padding: 12px 18px; font-size: 13px; margin-bottom: 18px; letter-spacing: 0.01em;
|
| 686 |
+
}
|
| 687 |
+
.fs-caption {
|
| 688 |
+
background: var(--sage-soft); border: 1px solid var(--hairline); border-radius: 18px;
|
| 689 |
+
padding: 16px 20px; margin-bottom: 20px; font-size: 14px; color: var(--charcoal-soft);
|
| 690 |
+
}
|
| 691 |
+
.fs-caption-label { font-weight: 600; color: var(--charcoal); }
|
| 692 |
|
| 693 |
+
.fs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
|
| 694 |
@media (max-width: 900px) { .fs-grid { grid-template-columns: 1fr; } }
|
| 695 |
|
| 696 |
+
.fs-look-card {
|
| 697 |
+
background: var(--white); border: 1px solid var(--hairline); border-radius: 25px;
|
| 698 |
+
padding: 22px; box-shadow: 0px 10px 30px rgba(0,0,0,0.05);
|
| 699 |
+
}
|
| 700 |
+
.fs-look-head {
|
| 701 |
+
display: flex; align-items: center; gap: 14px; margin-bottom: 18px;
|
| 702 |
+
padding-bottom: 18px; border-bottom: 1px solid var(--hairline);
|
| 703 |
+
}
|
| 704 |
+
.fs-look-avatar {
|
| 705 |
+
width: 50px; height: 50px; border-radius: 50%; flex-shrink: 0;
|
| 706 |
+
border: 2px solid var(--gold); box-shadow: 0 4px 10px rgba(0,0,0,0.08);
|
| 707 |
+
display: inline-block;
|
| 708 |
+
}
|
| 709 |
+
.fs-look-title {
|
| 710 |
+
font-family: 'Montserrat', sans-serif; font-weight: 300; font-size: 22px;
|
| 711 |
+
letter-spacing: 0.01em; color: var(--charcoal);
|
| 712 |
+
}
|
| 713 |
+
.fs-look-sub { color: var(--text-muted); font-size: 13px; margin-top: 3px; letter-spacing: 0.01em; }
|
| 714 |
+
|
| 715 |
+
.fs-component {
|
| 716 |
+
border: 1px solid var(--hairline); border-radius: 18px; overflow: hidden; margin-bottom: 14px;
|
| 717 |
+
transition: box-shadow .2s ease;
|
| 718 |
+
}
|
| 719 |
+
.fs-component:hover { box-shadow: 0px 6px 18px rgba(0,0,0,0.05); }
|
| 720 |
+
.fs-component:last-child { margin-bottom: 0; }
|
| 721 |
+
.fs-component-swatch { background: var(--cream); height: 68px; display: flex; align-items: center; justify-content: center; }
|
| 722 |
+
.fs-swatch-dot {
|
| 723 |
+
width: 36px; height: 36px; border-radius: 50%; display: inline-block;
|
| 724 |
+
box-shadow: 0 0 0 3px var(--white), 0 3px 8px rgba(0,0,0,0.12);
|
| 725 |
+
}
|
| 726 |
+
.fs-component-body { padding: 14px 16px; background: var(--white); border-top: 1px solid var(--hairline); }
|
| 727 |
+
.fs-component-label {
|
| 728 |
+
color: var(--rose); font-weight: 600; font-size: 11px; letter-spacing: .12em;
|
| 729 |
+
text-transform: uppercase; margin-bottom: 4px;
|
| 730 |
+
}
|
| 731 |
+
.fs-component-name {
|
| 732 |
+
font-weight: 500; color: var(--charcoal); font-size: 14.5px; margin-bottom: 12px;
|
| 733 |
+
line-height: 1.35; letter-spacing: 0.01em;
|
| 734 |
+
}
|
| 735 |
+
.fs-shop-btn {
|
| 736 |
+
display: inline-flex; align-items: center; gap: 6px; background: var(--charcoal);
|
| 737 |
+
color: #fff !important; padding: 9px 20px; border-radius: 999px; font-size: 11.5px;
|
| 738 |
+
font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
|
| 739 |
+
text-decoration: none !important; transition: transform .2s ease, background-color .2s ease;
|
| 740 |
+
}
|
| 741 |
+
.fs-shop-btn:hover { background: #333333; transform: scale(1.05); }
|
| 742 |
+
|
| 743 |
+
.fs-colors-footer {
|
| 744 |
+
color: var(--text-muted); font-size: 12px; margin-top: 8px; padding-top: 14px;
|
| 745 |
+
border-top: 1px solid var(--hairline); letter-spacing: 0.01em;
|
| 746 |
+
}
|
| 747 |
+
|
| 748 |
+
.fs-error { background: #FBEEEE; border: 1px solid #F0D6D6; border-radius: 18px; padding: 20px 22px; }
|
| 749 |
+
.fs-error-title { color: #9A4A4A; font-weight: 600; margin-bottom: 4px; letter-spacing: 0.01em; }
|
| 750 |
+
.fs-error-msg { color: #7a5c5c; font-size: 14px; }
|
| 751 |
"""
|
| 752 |
|
| 753 |
|
|
|
|
| 875 |
return gr.update(visible=is_photo), gr.update(visible=not is_photo)
|
| 876 |
|
| 877 |
theme = gr.themes.Soft(
|
| 878 |
+
primary_hue=gr.themes.colors.rose,
|
| 879 |
+
secondary_hue=gr.themes.colors.green,
|
| 880 |
+
neutral_hue=gr.themes.colors.stone,
|
| 881 |
+
font=gr.themes.GoogleFont("Inter"),
|
| 882 |
+
font_mono=gr.themes.GoogleFont("Inter"),
|
| 883 |
).set(
|
| 884 |
+
# Page + panel backgrounds — soft off-white / cream, no harsh whites or greys
|
| 885 |
+
body_background_fill="#FDFBF7",
|
| 886 |
+
body_background_fill_dark="#FDFBF7",
|
| 887 |
+
block_background_fill="#FFFFFF",
|
| 888 |
+
block_background_fill_dark="#FFFFFF",
|
| 889 |
+
block_border_color="#EEEEEE",
|
| 890 |
+
block_border_color_dark="#EEEEEE",
|
| 891 |
+
block_radius="20px",
|
| 892 |
+
container_radius="20px",
|
| 893 |
+
block_shadow="0px 10px 30px rgba(0,0,0,0.04)",
|
| 894 |
+
block_label_text_color="#948D80",
|
| 895 |
+
block_label_text_color_dark="#948D80",
|
| 896 |
+
block_label_text_weight="500",
|
| 897 |
+
block_title_text_color="#1A1A1A",
|
| 898 |
+
block_title_text_color_dark="#1A1A1A",
|
| 899 |
+
panel_background_fill="#FFFFFF",
|
| 900 |
+
panel_background_fill_dark="#FFFFFF",
|
| 901 |
+
# Inputs (dropdowns, image upload, textboxes) — rounded, cream, soft pastel
|
| 902 |
+
input_background_fill="#FDFBF7",
|
| 903 |
+
input_background_fill_dark="#FDFBF7",
|
| 904 |
+
input_border_color="#EAE6DD",
|
| 905 |
+
input_border_color_dark="#EAE6DD",
|
| 906 |
+
input_border_color_focus="#C48793",
|
| 907 |
+
input_radius="14px",
|
| 908 |
+
checkbox_border_radius="8px",
|
| 909 |
+
checkbox_background_color="#FDFBF7",
|
| 910 |
+
checkbox_background_color_selected="#C48793",
|
| 911 |
+
checkbox_border_color_selected="#C48793",
|
| 912 |
+
# Buttons — solid charcoal pill, smooth hover lift
|
| 913 |
+
button_primary_background_fill="#1A1A1A",
|
| 914 |
+
button_primary_background_fill_hover="#333333",
|
| 915 |
button_primary_text_color="#FFFFFF",
|
| 916 |
+
button_primary_border_color="#1A1A1A",
|
| 917 |
+
button_large_radius="999px",
|
| 918 |
+
button_medium_radius="999px",
|
| 919 |
+
button_small_radius="999px",
|
| 920 |
+
button_transition="all 0.2s ease",
|
| 921 |
)
|
| 922 |
|
| 923 |
with gr.Blocks(css=CUSTOM_CSS, theme=theme, title="Personal Style Matcher") as demo:
|