File size: 1,982 Bytes
0e9675b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import gradio as gr
from PIL import Image

def generate_fn(prompt, image):
    # Stub: echo for now (swap with real gen later)
    if not prompt and image is None:
        raise gr.Error("Add a prompt or an image.")
    msg = f"OK ✅  Prompt length: {len(prompt or '')} | Image: {'yes' if image else 'no'}"
    return msg

CUSTOM_CSS = """
/* Page padding & grid background hint (optional) */
.gradio-container { padding: 24px; }

/* Big rounded prompt box */
#prompt-box textarea {
  border-radius: 28px !important;
  min-height: 180px;
  font-size: 18px;
  line-height: 1.45;
  padding: 18px 22px;
}

/* Rounded square image card */
#add-image .wrap.svelte-1ipelgc, 
#add-image .wrap {  /* compat across versions */
  border-radius: 28px !important;
}
#add-image .input-image, 
#add-image .empty.svelte-1ipelgc {
  border-radius: 28px !important;
  min-width: 240px;
  min-height: 240px;
}

/* Pill generate button (right side) */
#gen-btn button {
  border-radius: 999px !important;
  padding: 12px 24px;
  font-size: 18px;
}
"""

with gr.Blocks(css=CUSTOM_CSS, title="StitchMaster – UI Sketch") as demo:
    # Row 1: Big rounded prompt input
    prompt = gr.Textbox(
        label=None,
        placeholder="Prompt input",
        lines=8,
        elem_id="prompt-box"
    )

    # Row 2: Left = Add Image card | Right = Generate button
    with gr.Row():
        with gr.Column(scale=1, min_width=300):
            img = gr.Image(
                label="Add Image",
                type="pil",
                elem_id="add-image"
            )
        with gr.Column(scale=3, min_width=300):
            # Spacer effect using Markdown (empty height) then right-aligned button
            gr.Markdown(" \n\n ", elem_classes=["spacer"])
            gen = gr.Button("Generate", elem_id="gen-btn")

    out = gr.Markdown("")  # simple status/output for now
    gen.click(fn=generate_fn, inputs=[prompt, img], outputs=out)

if __name__ == "__main__":
    demo.launch()