Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -551,11 +551,11 @@ def run_pipeline(enhanced, input_img, seed):
|
|
| 551 |
def _render_preview(otf_path, font_name):
|
| 552 |
try:
|
| 553 |
from PIL import Image, ImageDraw, ImageFont
|
| 554 |
-
sample = f"{font_name}\nAa Bb Cc 123\nThe quick brown fox
|
| 555 |
img = Image.new("RGB", (1700, 620), "white")
|
| 556 |
draw = ImageDraw.Draw(img)
|
| 557 |
font = ImageFont.truetype(otf_path, 150)
|
| 558 |
-
draw.multiline_text((
|
| 559 |
return img
|
| 560 |
except Exception as e:
|
| 561 |
print(f"β οΈ Preview failed: {e}")
|
|
@@ -629,17 +629,17 @@ def _load_title_font():
|
|
| 629 |
TITLE_FONT_FACE, TITLE_FAMILY = _load_title_font()
|
| 630 |
|
| 631 |
# =============================================================================
|
| 632 |
-
# THEME β International Typographic Style (
|
| 633 |
# =============================================================================
|
| 634 |
THEME = gr.themes.Base(
|
| 635 |
-
primary_hue=gr.themes.colors.
|
| 636 |
neutral_hue=gr.themes.colors.gray,
|
| 637 |
radius_size=gr.themes.sizes.radius_none,
|
| 638 |
font=["Helvetica Neue", "Helvetica", gr.themes.GoogleFont("Archivo"), "Arial", "sans-serif"],
|
| 639 |
font_mono=[gr.themes.GoogleFont("JetBrains Mono"), "ui-monospace", "monospace"],
|
| 640 |
).set(
|
| 641 |
-
body_background_fill="#
|
| 642 |
-
body_background_fill_dark="#
|
| 643 |
body_text_color="#000000",
|
| 644 |
body_text_color_dark="#000000",
|
| 645 |
body_text_color_subdued="#6B6B6B",
|
|
@@ -666,22 +666,22 @@ THEME = gr.themes.Base(
|
|
| 666 |
input_background_fill_dark="#FFFFFF",
|
| 667 |
input_border_color="#000000",
|
| 668 |
input_border_color_dark="#000000",
|
| 669 |
-
input_border_color_focus="#
|
| 670 |
-
input_border_color_focus_dark="#
|
| 671 |
input_shadow="none",
|
| 672 |
input_shadow_dark="none",
|
| 673 |
input_shadow_focus="none",
|
| 674 |
input_shadow_focus_dark="none",
|
| 675 |
shadow_drop="none",
|
| 676 |
shadow_drop_lg="none",
|
| 677 |
-
button_primary_background_fill="#
|
| 678 |
-
button_primary_background_fill_dark="#
|
| 679 |
button_primary_background_fill_hover="#000000",
|
| 680 |
button_primary_background_fill_hover_dark="#000000",
|
| 681 |
button_primary_text_color="#FFFFFF",
|
| 682 |
button_primary_text_color_dark="#FFFFFF",
|
| 683 |
-
button_primary_border_color="#
|
| 684 |
-
button_primary_border_color_dark="#
|
| 685 |
button_secondary_background_fill="#FFFFFF",
|
| 686 |
button_secondary_background_fill_dark="#FFFFFF",
|
| 687 |
button_secondary_text_color="#000000",
|
|
@@ -696,7 +696,8 @@ CSS = """
|
|
| 696 |
:root {
|
| 697 |
--ink: #000000;
|
| 698 |
--paper: #FFFFFF;
|
| 699 |
-
--
|
|
|
|
| 700 |
--grey: #6B6B6B;
|
| 701 |
--hairline: #D8D8D8;
|
| 702 |
--grotesk: 'Helvetica Neue', Helvetica, 'Archivo', Arial, sans-serif;
|
|
@@ -709,7 +710,7 @@ CSS = """
|
|
| 709 |
margin: 0 !important;
|
| 710 |
padding-left: clamp(20px, 5vw, 72px) !important;
|
| 711 |
padding-right: clamp(20px, 5vw, 72px) !important;
|
| 712 |
-
background: var(--
|
| 713 |
}
|
| 714 |
|
| 715 |
/* Kill every radius and shadow β flat ink on paper */
|
|
@@ -742,7 +743,7 @@ CSS = """
|
|
| 742 |
margin: 0;
|
| 743 |
color: var(--ink);
|
| 744 |
}
|
| 745 |
-
#hero h1 .stop { color: var(--
|
| 746 |
#hero .meta {
|
| 747 |
font-family: var(--grotesk);
|
| 748 |
font-size: 11px;
|
|
@@ -766,7 +767,7 @@ CSS = """
|
|
| 766 |
#hero .meta .v { text-align: right; }
|
| 767 |
|
| 768 |
/* =========================================================================
|
| 769 |
-
SECTION HEADS β
|
| 770 |
========================================================================= */
|
| 771 |
.eyebrow {
|
| 772 |
font-family: var(--grotesk) !important;
|
|
@@ -775,11 +776,9 @@ CSS = """
|
|
| 775 |
font-size: 11px !important;
|
| 776 |
font-weight: 700 !important;
|
| 777 |
color: var(--ink) !important;
|
| 778 |
-
border-top: 2px solid var(--ink);
|
| 779 |
-
padding-top: 8px !important;
|
| 780 |
margin: 0 0 6px !important;
|
| 781 |
}
|
| 782 |
-
.eyebrow .idx { color: var(--
|
| 783 |
|
| 784 |
/* Component labels */
|
| 785 |
.gradio-container label span,
|
|
@@ -803,12 +802,12 @@ CSS = """
|
|
| 803 |
}
|
| 804 |
.gradio-container textarea:focus,
|
| 805 |
.gradio-container input:focus {
|
| 806 |
-
border-color: var(--
|
| 807 |
-
outline: 2px solid var(--
|
| 808 |
outline-offset: -1px;
|
| 809 |
}
|
| 810 |
|
| 811 |
-
/* Primary CTA β
|
| 812 |
.go-btn {
|
| 813 |
text-transform: uppercase !important;
|
| 814 |
letter-spacing: 0.22em !important;
|
|
@@ -841,10 +840,8 @@ CSS = """
|
|
| 841 |
#otf-file .unpadded_box, #otf-file .empty { min-height: 56px !important; height: 56px !important; }
|
| 842 |
#preview-img .unpadded_box, #preview-img .empty { min-height: 96px !important; }
|
| 843 |
|
| 844 |
-
/* Progress
|
| 845 |
-
|
| 846 |
-
/* Progress bar in red, flat β single gauge inside the grids block */
|
| 847 |
-
.gradio-container .progress-bar { background: var(--red) !important; }
|
| 848 |
#grids { min-height: 240px; }
|
| 849 |
#grids .progress-text, #grids .progress-level-inner, #grids .meta-text, #grids .meta-text-center {
|
| 850 |
font-family: var(--mono) !important;
|
|
|
|
| 551 |
def _render_preview(otf_path, font_name):
|
| 552 |
try:
|
| 553 |
from PIL import Image, ImageDraw, ImageFont
|
| 554 |
+
sample = f"{font_name}\nAa Bb Cc 123\nThe quick brown fox"
|
| 555 |
img = Image.new("RGB", (1700, 620), "white")
|
| 556 |
draw = ImageDraw.Draw(img)
|
| 557 |
font = ImageFont.truetype(otf_path, 150)
|
| 558 |
+
draw.multiline_text((40, 30), sample, font=font, fill="black", spacing=30)
|
| 559 |
return img
|
| 560 |
except Exception as e:
|
| 561 |
print(f"β οΈ Preview failed: {e}")
|
|
|
|
| 629 |
TITLE_FONT_FACE, TITLE_FAMILY = _load_title_font()
|
| 630 |
|
| 631 |
# =============================================================================
|
| 632 |
+
# THEME β International Typographic Style (light grey / black / violet)
|
| 633 |
# =============================================================================
|
| 634 |
THEME = gr.themes.Base(
|
| 635 |
+
primary_hue=gr.themes.colors.violet,
|
| 636 |
neutral_hue=gr.themes.colors.gray,
|
| 637 |
radius_size=gr.themes.sizes.radius_none,
|
| 638 |
font=["Helvetica Neue", "Helvetica", gr.themes.GoogleFont("Archivo"), "Arial", "sans-serif"],
|
| 639 |
font_mono=[gr.themes.GoogleFont("JetBrains Mono"), "ui-monospace", "monospace"],
|
| 640 |
).set(
|
| 641 |
+
body_background_fill="#ECECEC",
|
| 642 |
+
body_background_fill_dark="#ECECEC",
|
| 643 |
body_text_color="#000000",
|
| 644 |
body_text_color_dark="#000000",
|
| 645 |
body_text_color_subdued="#6B6B6B",
|
|
|
|
| 666 |
input_background_fill_dark="#FFFFFF",
|
| 667 |
input_border_color="#000000",
|
| 668 |
input_border_color_dark="#000000",
|
| 669 |
+
input_border_color_focus="#5F2EEA",
|
| 670 |
+
input_border_color_focus_dark="#5F2EEA",
|
| 671 |
input_shadow="none",
|
| 672 |
input_shadow_dark="none",
|
| 673 |
input_shadow_focus="none",
|
| 674 |
input_shadow_focus_dark="none",
|
| 675 |
shadow_drop="none",
|
| 676 |
shadow_drop_lg="none",
|
| 677 |
+
button_primary_background_fill="#5F2EEA",
|
| 678 |
+
button_primary_background_fill_dark="#5F2EEA",
|
| 679 |
button_primary_background_fill_hover="#000000",
|
| 680 |
button_primary_background_fill_hover_dark="#000000",
|
| 681 |
button_primary_text_color="#FFFFFF",
|
| 682 |
button_primary_text_color_dark="#FFFFFF",
|
| 683 |
+
button_primary_border_color="#5F2EEA",
|
| 684 |
+
button_primary_border_color_dark="#5F2EEA",
|
| 685 |
button_secondary_background_fill="#FFFFFF",
|
| 686 |
button_secondary_background_fill_dark="#FFFFFF",
|
| 687 |
button_secondary_text_color="#000000",
|
|
|
|
| 696 |
:root {
|
| 697 |
--ink: #000000;
|
| 698 |
--paper: #FFFFFF;
|
| 699 |
+
--bg: #ECECEC;
|
| 700 |
+
--accent: #5F2EEA;
|
| 701 |
--grey: #6B6B6B;
|
| 702 |
--hairline: #D8D8D8;
|
| 703 |
--grotesk: 'Helvetica Neue', Helvetica, 'Archivo', Arial, sans-serif;
|
|
|
|
| 710 |
margin: 0 !important;
|
| 711 |
padding-left: clamp(20px, 5vw, 72px) !important;
|
| 712 |
padding-right: clamp(20px, 5vw, 72px) !important;
|
| 713 |
+
background: var(--bg) !important;
|
| 714 |
}
|
| 715 |
|
| 716 |
/* Kill every radius and shadow β flat ink on paper */
|
|
|
|
| 743 |
margin: 0;
|
| 744 |
color: var(--ink);
|
| 745 |
}
|
| 746 |
+
#hero h1 .stop { color: var(--accent); }
|
| 747 |
#hero .meta {
|
| 748 |
font-family: var(--grotesk);
|
| 749 |
font-size: 11px;
|
|
|
|
| 767 |
#hero .meta .v { text-align: right; }
|
| 768 |
|
| 769 |
/* =========================================================================
|
| 770 |
+
SECTION HEADS β violet index
|
| 771 |
========================================================================= */
|
| 772 |
.eyebrow {
|
| 773 |
font-family: var(--grotesk) !important;
|
|
|
|
| 776 |
font-size: 11px !important;
|
| 777 |
font-weight: 700 !important;
|
| 778 |
color: var(--ink) !important;
|
|
|
|
|
|
|
| 779 |
margin: 0 0 6px !important;
|
| 780 |
}
|
| 781 |
+
.eyebrow .idx { color: var(--accent); margin-right: 12px; }
|
| 782 |
|
| 783 |
/* Component labels */
|
| 784 |
.gradio-container label span,
|
|
|
|
| 802 |
}
|
| 803 |
.gradio-container textarea:focus,
|
| 804 |
.gradio-container input:focus {
|
| 805 |
+
border-color: var(--accent) !important;
|
| 806 |
+
outline: 2px solid var(--accent) !important;
|
| 807 |
outline-offset: -1px;
|
| 808 |
}
|
| 809 |
|
| 810 |
+
/* Primary CTA β violet plate, uppercase, no ornament */
|
| 811 |
.go-btn {
|
| 812 |
text-transform: uppercase !important;
|
| 813 |
letter-spacing: 0.22em !important;
|
|
|
|
| 840 |
#otf-file .unpadded_box, #otf-file .empty { min-height: 56px !important; height: 56px !important; }
|
| 841 |
#preview-img .unpadded_box, #preview-img .empty { min-height: 96px !important; }
|
| 842 |
|
| 843 |
+
/* Progress β single violet gauge inside the grids block */
|
| 844 |
+
.gradio-container .progress-bar { background: var(--accent) !important; }
|
|
|
|
|
|
|
| 845 |
#grids { min-height: 240px; }
|
| 846 |
#grids .progress-text, #grids .progress-level-inner, #grids .meta-text, #grids .meta-text-center {
|
| 847 |
font-family: var(--mono) !important;
|