Spaces:
Running
on
Zero
Running
on
Zero
Upload app.py
Browse files
app.py
CHANGED
@@ -37,89 +37,42 @@ MAX_SEED = np.iinfo(np.int32).max
|
|
37 |
MAX_IMAGE_SIZE = 1216
|
38 |
|
39 |
css = """
|
40 |
-
#container {
|
41 |
-
|
42 |
-
}
|
43 |
-
#col-container {
|
44 |
-
margin: 0 auto;
|
45 |
-
}
|
46 |
-
#result { max-width: 520px; max-height: 520px; width: 520px; height: 520px; }
|
47 |
#model-info { text-align: center; }
|
48 |
"""
|
49 |
|
50 |
with gr.Blocks(css=css, fill_width=True, elem_id="container") as demo:
|
51 |
with gr.Tab("Image Generator"):
|
52 |
with gr.Column(elem_id="col-container"):
|
53 |
-
|
54 |
-
|
55 |
-
label="Prompt",
|
56 |
-
show_label=False,
|
57 |
-
lines=1,
|
58 |
-
max_lines=8,
|
59 |
-
placeholder="Enter your prompt",
|
60 |
-
container=False,
|
61 |
-
)
|
62 |
|
63 |
with gr.Row():
|
64 |
run_button = gr.Button("Run")
|
65 |
run_translate_button = gr.Button("Translate")
|
66 |
|
67 |
-
|
68 |
-
|
|
|
|
|
69 |
with gr.Accordion("Advanced Settings", open=False):
|
70 |
-
|
71 |
-
negative_prompt = gr.Text(
|
72 |
-
label="Negative prompt",
|
73 |
-
lines=1,
|
74 |
-
max_lines=6,
|
75 |
-
placeholder="Enter a negative prompt",
|
76 |
-
value="(low quality, worst quality:1.2), very displeasing, watermark, signature, ugly"
|
77 |
-
)
|
78 |
-
|
79 |
with gr.Row():
|
80 |
-
|
81 |
-
|
82 |
-
minimum=0,
|
83 |
-
maximum=MAX_SEED,
|
84 |
-
step=1,
|
85 |
-
value=0,
|
86 |
-
)
|
87 |
|
|
|
|
|
88 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
89 |
|
90 |
with gr.Row():
|
91 |
-
width = gr.Slider(
|
92 |
-
|
93 |
-
minimum=256,
|
94 |
-
maximum=MAX_IMAGE_SIZE,
|
95 |
-
step=32,
|
96 |
-
value=1024,#832,
|
97 |
-
)
|
98 |
-
|
99 |
-
height = gr.Slider(
|
100 |
-
label="Height",
|
101 |
-
minimum=256,
|
102 |
-
maximum=MAX_IMAGE_SIZE,
|
103 |
-
step=32,
|
104 |
-
value=1024,#1216,
|
105 |
-
)
|
106 |
|
107 |
with gr.Row():
|
108 |
-
guidance_scale = gr.Slider(
|
109 |
-
|
110 |
-
minimum=0.0,
|
111 |
-
maximum=30.0,
|
112 |
-
step=0.1,
|
113 |
-
value=7,
|
114 |
-
)
|
115 |
-
|
116 |
-
num_inference_steps = gr.Slider(
|
117 |
-
label="Number of inference steps",
|
118 |
-
minimum=1,
|
119 |
-
maximum=100,
|
120 |
-
step=1,
|
121 |
-
value=28,
|
122 |
-
)
|
123 |
|
124 |
with gr.Row():
|
125 |
with gr.Group():
|
|
|
37 |
MAX_IMAGE_SIZE = 1216
|
38 |
|
39 |
css = """
|
40 |
+
#container { margin: 0 auto; }
|
41 |
+
#col-container { margin: 0 auto; }
|
42 |
+
#result { max-width: 520px; max-height: 520px; width: 520px; height: 520px; align: center; }
|
|
|
|
|
|
|
|
|
43 |
#model-info { text-align: center; }
|
44 |
"""
|
45 |
|
46 |
with gr.Blocks(css=css, fill_width=True, elem_id="container") as demo:
|
47 |
with gr.Tab("Image Generator"):
|
48 |
with gr.Column(elem_id="col-container"):
|
49 |
+
with gr.Row():
|
50 |
+
prompt = gr.Text(label="Prompt", show_label=False, lines=1, max_lines=8, placeholder="Enter your prompt", container=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
with gr.Row():
|
53 |
run_button = gr.Button("Run")
|
54 |
run_translate_button = gr.Button("Translate")
|
55 |
|
56 |
+
with gr.Row():
|
57 |
+
result = gr.Image(label="Result", elem_id="result", show_label=False, interactive=False,
|
58 |
+
show_download_button=True, show_share_button=False, container=True)
|
59 |
+
|
60 |
with gr.Accordion("Advanced Settings", open=False):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
with gr.Row():
|
62 |
+
negative_prompt = gr.Text(label="Negative prompt", lines=1, max_lines=6, placeholder="Enter a negative prompt",
|
63 |
+
value="(low quality, worst quality:1.2), very displeasing, watermark, signature, ugly")
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
+
with gr.Row():
|
66 |
+
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0)
|
67 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
68 |
|
69 |
with gr.Row():
|
70 |
+
width = gr.Slider(label="Width", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=1024) # 832
|
71 |
+
height = gr.Slider(label="Height", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=1024) # 1216
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
with gr.Row():
|
74 |
+
guidance_scale = gr.Slider(label="Guidance scale", minimum=0.0, maximum=30.0, step=0.1, value=7)
|
75 |
+
num_inference_steps = gr.Slider(label="Number of inference steps", minimum=1, maximum=100, step=1, value=28)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
with gr.Row():
|
78 |
with gr.Group():
|