File size: 1,170 Bytes
9b3b7c9
245705c
e6263c8
245705c
e6263c8
 
9bd2b4c
245705c
9bd2b4c
 
 
 
 
245705c
e6263c8
 
 
9bd2b4c
e6263c8
 
 
9bd2b4c
e6263c8
245705c
 
e6263c8
245705c
 
e6263c8
245705c
e6263c8
 
9bd2b4c
e6263c8
245705c
9bd2b4c
e6263c8
9bd2b4c
e6263c8
 
245705c
e6263c8
 
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
import gradio as gr
from inference import generate

default_prompt = """Cinematic portrait of a Japanese girl as Shinobu Kocho, realistic facial features, gradient purple compound eyes, intricate butterfly hair ornament, wearing silk haori with butterfly wing patterns, soft moonlight, hyper-realistic, depth of field, purple butterfly particles, ethereal lighting"""


def run(prompt, height, width, steps, seed):
    return generate(
        prompt,
        height,
        width,
        steps,
        seed,
    )


with gr.Blocks() as demo:
    gr.Markdown("## Z-Image Turbo")

    with gr.Row():
        with gr.Column():
            prompt = gr.Textbox(value=default_prompt, lines=4)

            height = gr.Slider(256, 1024, value=512, step=64)
            width = gr.Slider(256, 1024, value=512, step=64)

            steps = gr.Slider(1, 20, value=9, step=1)
            seed = gr.Number(value=-1)

            btn = gr.Button("Generate")

        with gr.Column():
            output = gr.Image()

    btn.click(
        fn=run,
        inputs=[prompt, height, width, steps, seed],
        outputs=output,
    )


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