""" app.py — Hugging Face Space entry point for Sage & Sand Neumorphic theme. This file runs the live demo that visitors see on your Space page. """ import time import gradio as gr from theme import SageAndSandNeumorphic, NEUMORPHIC_CSS with gr.Blocks( theme=SageAndSandNeumorphic(), css=NEUMORPHIC_CSS, title="Sage & Sand Neumorphic", ) as demo: gr.Markdown( """ # 🌿 Sage & Sand — Neumorphic Theme A warm, soft-extruded Gradio theme for Stable Diffusion interfaces. Install: `pip install gradio` then copy `theme.py` into your project. """ ) with gr.Row(): with gr.Column(scale=1): prompt = gr.Textbox(label="Prompt", lines=3, placeholder="A serene landscape at golden hour…") neg_prompt = gr.Textbox(label="Negative prompt", lines=2, placeholder="blurry, low quality, watermark…") with gr.Row(): steps = gr.Slider(1, 150, value=20, step=1, label="Steps") cfg = gr.Slider(1, 30, value=7, step=0.5, label="CFG Scale") with gr.Row(): sampler = gr.Dropdown( ["Euler a", "DPM++ 2M", "DPM++ SDE", "DDIM", "UniPC"], value="Euler a", label="Sampler" ) faces = gr.Checkbox(label="Restore faces", value=False) tiling = gr.Checkbox(label="Tiling", value=False) with gr.Row(): generate_btn = gr.Button("Generate", variant="primary") interrupt_btn = gr.Button("Interrupt", variant="stop") with gr.Column(scale=1): output_image = gr.Image(label="Output", height=360) with gr.Accordion("Generation info", open=False): gen_info = gr.Textbox(label="Parameters", lines=4, interactive=False) with gr.Tabs(): with gr.Tab("Settings"): with gr.Row(): width = gr.Slider(512, 2048, value=512, step=64, label="Width") height = gr.Slider(512, 2048, value=512, step=64, label="Height") with gr.Row(): batch_s = gr.Slider(1, 8, value=1, step=1, label="Batch size") batch_c = gr.Slider(1, 16, value=1, step=1, label="Batch count") seed = gr.Number(label="Seed", value=-1, precision=0) with gr.Tab("ControlNet"): cn_model = gr.Textbox(label="ControlNet model", placeholder="control_v11p_sd15_openpose") cn_weight = gr.Slider(0, 2, value=1, step=0.05, label="Control weight") cn_start = gr.Slider(0, 1, value=0, step=0.05, label="Starting control step") cn_end = gr.Slider(0, 1, value=1, step=0.05, label="Ending control step") with gr.Tab("Hires. fix"): hires_on = gr.Checkbox(label="Enable Hires. fix", value=False) hires_upscaler = gr.Dropdown( ["Latent", "ESRGAN_4x", "R-ESRGAN 4x+", "SwinIR_4x"], value="Latent", label="Upscaler" ) with gr.Row(): hires_steps = gr.Slider(0, 150, value=0, step=1, label="Hires steps") hires_denoise = gr.Slider(0, 1, value=0.7, step=0.01, label="Denoising strength") with gr.Tab("Scripts"): script = gr.Dropdown(["None", "X/Y/Z plot", "Prompt matrix", "Ultimate SD upscale"], value="None", label="Script") if __name__ == "__main__": demo.launch()