Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -551,31 +551,18 @@ def create_ui(generator: FontMoodGenerator):
|
|
| 551 |
|
| 552 |
# STEP 4: Export and Use
|
| 553 |
with gr.Step("💾 Export & Use Your Fonts", id=3):
|
|
|
|
|
|
|
| 554 |
gr.Markdown("""
|
| 555 |
### Step 4: Get the code and use your fonts
|
| 556 |
Copy the CSS code below to use your font palette in your own projects.
|
| 557 |
""")
|
| 558 |
-
|
| 559 |
css_code_output = gr.Code(
|
| 560 |
language="css",
|
| 561 |
label="Your Font Palette CSS",
|
| 562 |
value="/* Generate a palette first to see CSS code here */",
|
| 563 |
lines=15
|
| 564 |
-
)
|
| 565 |
-
palette_preview = gr.HTML(label="Font Palette Preview")
|
| 566 |
-
|
| 567 |
-
# Update the palette preview when font data changes
|
| 568 |
-
def update_palette_preview(font_data_json):
|
| 569 |
-
if not font_data_json:
|
| 570 |
-
return ""
|
| 571 |
-
top_hits = [{"corpus_id": item["corpus_id"], "score": item["score"]} for item in font_data_json]
|
| 572 |
-
return generator._format_palette_as_html(top_hits)
|
| 573 |
-
|
| 574 |
-
font_data_hidden.change(
|
| 575 |
-
fn=update_palette_preview,
|
| 576 |
-
inputs=font_data_hidden,
|
| 577 |
-
outputs=palette_preview
|
| 578 |
-
)
|
| 579 |
|
| 580 |
# Update CSS code when font data changes
|
| 581 |
def update_css_code(font_data_json):
|
|
@@ -589,6 +576,15 @@ def create_ui(generator: FontMoodGenerator):
|
|
| 589 |
inputs=font_data_hidden,
|
| 590 |
outputs=css_code_output
|
| 591 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 592 |
|
| 593 |
gr.Markdown("""
|
| 594 |
**🚀 Next Steps:**
|
|
|
|
| 551 |
|
| 552 |
# STEP 4: Export and Use
|
| 553 |
with gr.Step("💾 Export & Use Your Fonts", id=3):
|
| 554 |
+
|
| 555 |
+
theme_css_display_step4 = gr.HTML()
|
| 556 |
gr.Markdown("""
|
| 557 |
### Step 4: Get the code and use your fonts
|
| 558 |
Copy the CSS code below to use your font palette in your own projects.
|
| 559 |
""")
|
|
|
|
| 560 |
css_code_output = gr.Code(
|
| 561 |
language="css",
|
| 562 |
label="Your Font Palette CSS",
|
| 563 |
value="/* Generate a palette first to see CSS code here */",
|
| 564 |
lines=15
|
| 565 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 566 |
|
| 567 |
# Update CSS code when font data changes
|
| 568 |
def update_css_code(font_data_json):
|
|
|
|
| 576 |
inputs=font_data_hidden,
|
| 577 |
outputs=css_code_output
|
| 578 |
)
|
| 579 |
+
|
| 580 |
+
def apply_theme_to_step4(theme_css):
|
| 581 |
+
return theme_css
|
| 582 |
+
|
| 583 |
+
theme_css_hidden.change(
|
| 584 |
+
fn=apply_theme_to_step4,
|
| 585 |
+
inputs=theme_css_hidden,
|
| 586 |
+
outputs=theme_css_display_step4
|
| 587 |
+
)
|
| 588 |
|
| 589 |
gr.Markdown("""
|
| 590 |
**🚀 Next Steps:**
|