Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -562,10 +562,8 @@ def _render_preview(otf_path, font_name):
|
|
| 562 |
return None
|
| 563 |
|
| 564 |
|
| 565 |
-
def generate(prompt, control_image,
|
| 566 |
-
|
| 567 |
-
seed = random.randint(0, 2**32 - 1)
|
| 568 |
-
seed = int(seed)
|
| 569 |
|
| 570 |
input_img = None
|
| 571 |
prefixes = ["Vex","Aur","Kyr","Lux","Nox","Arc","Sol","Vel","Fen","Zor","Cal","Dex","Ora","Pax","Rux"]
|
|
@@ -869,8 +867,14 @@ CSS = """
|
|
| 869 |
vertical-align: baseline;
|
| 870 |
}
|
| 871 |
|
| 872 |
-
/* Progress bar in red, flat */
|
| 873 |
.gradio-container .progress-bar { background: var(--red) !important; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 874 |
|
| 875 |
@media (prefers-reduced-motion: reduce) {
|
| 876 |
.gradio-container * { transition: none !important; animation: none !important; }
|
|
@@ -906,21 +910,20 @@ with gr.Blocks(title="Typotopia", theme=THEME, css=CSS) as demo:
|
|
| 906 |
lines=2,
|
| 907 |
)
|
| 908 |
control_image = gr.Image(label="Control image (optional)", type="pil", height=140, elem_id="control-image")
|
| 909 |
-
with gr.Row():
|
| 910 |
-
seed = gr.Number(label="Seed", value=0, precision=0)
|
| 911 |
-
random_seed = gr.Checkbox(label="Random seed", value=True)
|
| 912 |
btn = gr.Button("Generate font", variant="primary", elem_classes=["go-btn"])
|
| 913 |
with gr.Column(scale=1):
|
| 914 |
gr.HTML("<p class='eyebrow'><span class='idx'>02</span>Specimen</p>")
|
| 915 |
status = gr.HTML(elem_classes=["status-line"])
|
| 916 |
otf_file = gr.File(label="Download .otf", height=56, elem_id="otf-file")
|
| 917 |
preview = gr.Image(label="Preview", type="pil", height=110, elem_id="preview-img")
|
| 918 |
-
gallery = gr.Gallery(label="Generated grids", columns=3, height=150, object_fit="contain")
|
| 919 |
|
| 920 |
btn.click(
|
| 921 |
generate,
|
| 922 |
-
inputs=[prompt, control_image
|
| 923 |
outputs=[gallery, preview, otf_file, status],
|
|
|
|
|
|
|
| 924 |
)
|
| 925 |
|
| 926 |
if __name__ == "__main__":
|
|
|
|
| 562 |
return None
|
| 563 |
|
| 564 |
|
| 565 |
+
def generate(prompt, control_image, progress=gr.Progress(track_tqdm=True)):
|
| 566 |
+
seed = random.randint(0, 2**32 - 1)
|
|
|
|
|
|
|
| 567 |
|
| 568 |
input_img = None
|
| 569 |
prefixes = ["Vex","Aur","Kyr","Lux","Nox","Arc","Sol","Vel","Fen","Zor","Cal","Dex","Ora","Pax","Rux"]
|
|
|
|
| 867 |
vertical-align: baseline;
|
| 868 |
}
|
| 869 |
|
| 870 |
+
/* Progress bar in red, flat — single gauge inside the grids block */
|
| 871 |
.gradio-container .progress-bar { background: var(--red) !important; }
|
| 872 |
+
#grids { min-height: 240px; }
|
| 873 |
+
#grids .progress-text, #grids .progress-level-inner, #grids .meta-text, #grids .meta-text-center {
|
| 874 |
+
font-family: var(--mono) !important;
|
| 875 |
+
font-size: 12px !important;
|
| 876 |
+
color: var(--ink) !important;
|
| 877 |
+
}
|
| 878 |
|
| 879 |
@media (prefers-reduced-motion: reduce) {
|
| 880 |
.gradio-container * { transition: none !important; animation: none !important; }
|
|
|
|
| 910 |
lines=2,
|
| 911 |
)
|
| 912 |
control_image = gr.Image(label="Control image (optional)", type="pil", height=140, elem_id="control-image")
|
|
|
|
|
|
|
|
|
|
| 913 |
btn = gr.Button("Generate font", variant="primary", elem_classes=["go-btn"])
|
| 914 |
with gr.Column(scale=1):
|
| 915 |
gr.HTML("<p class='eyebrow'><span class='idx'>02</span>Specimen</p>")
|
| 916 |
status = gr.HTML(elem_classes=["status-line"])
|
| 917 |
otf_file = gr.File(label="Download .otf", height=56, elem_id="otf-file")
|
| 918 |
preview = gr.Image(label="Preview", type="pil", height=110, elem_id="preview-img")
|
| 919 |
+
gallery = gr.Gallery(label="Generated grids", columns=3, height=150, object_fit="contain", elem_id="grids")
|
| 920 |
|
| 921 |
btn.click(
|
| 922 |
generate,
|
| 923 |
+
inputs=[prompt, control_image],
|
| 924 |
outputs=[gallery, preview, otf_file, status],
|
| 925 |
+
show_progress="full",
|
| 926 |
+
show_progress_on=gallery,
|
| 927 |
)
|
| 928 |
|
| 929 |
if __name__ == "__main__":
|