|
89 | 89 | step=0.1, |
90 | 90 | label="Guidance Scale", |
91 | 91 | ) |
| 92 | + precision = gr.Radio( |
| 93 | + label="Precision", |
| 94 | + value="fp16", |
| 95 | + choices=["fp16", "fp32"], |
| 96 | + ) |
92 | 97 | # Hidden Items |
93 | 98 | height = gr.Slider( |
94 | 99 | 384, |
|
108 | 113 | interactive=False, |
109 | 114 | visible=False, |
110 | 115 | ) |
111 | | - with gr.Row(): |
112 | | - precision = gr.Radio( |
113 | | - label="Precision", |
114 | | - value="fp16", |
115 | | - choices=["fp16", "fp32"], |
| 116 | + scheduler = gr.Radio( |
| 117 | + label="Scheduler", |
| 118 | + value="DPM", |
| 119 | + choices=["PNDM", "LMS", "DDIM", "DPM"], |
| 120 | + visible=False, |
116 | 121 | ) |
117 | | - uint32_info = iinfo(np.uint32) |
118 | | - rand_seed = randint(uint32_info.min, uint32_info.max) |
119 | | - seed = gr.Number( |
120 | | - value=rand_seed, |
121 | | - label="Seed", |
| 122 | + with gr.Row(equal_height=True): |
| 123 | + device = gr.Radio( |
| 124 | + label="Device", |
| 125 | + value="vulkan", |
| 126 | + choices=["cuda", "vulkan"], |
| 127 | + interactive=False, |
122 | 128 | ) |
123 | | - with gr.Row(): |
| 129 | + with gr.Group(): |
| 130 | + uint32_info = iinfo(np.uint32) |
| 131 | + rand_seed = randint(uint32_info.min, uint32_info.max) |
| 132 | + random_seed = gr.Button("Random seed").style( |
| 133 | + full_width=True |
| 134 | + ) |
| 135 | + seed = gr.Number(value=rand_seed, show_label=False) |
| 136 | + random_seed.click( |
| 137 | + lambda: randint(uint32_info.min, uint32_info.max), |
| 138 | + inputs=[], |
| 139 | + outputs=[seed], |
| 140 | + ) |
124 | 141 | cache = gr.Checkbox(label="Cache", value=True) |
125 | | - debug = gr.Checkbox(label="DEBUG", value=False) |
126 | | - save_img = gr.Checkbox(label="Save Image", value=False) |
| 142 | + debug = gr.Checkbox(label="DEBUG", value=True) |
| 143 | + save_img = gr.Checkbox( |
| 144 | + label="Save", value=False, visible=False |
| 145 | + ) |
127 | 146 | # Hidden Items. |
128 | 147 | live_preview = gr.Checkbox( |
129 | 148 | label="Live Preview", |
|
137 | 156 | interactive=False, |
138 | 157 | visible=False, |
139 | 158 | ) |
140 | | - scheduler = gr.Radio( |
141 | | - label="Scheduler", |
142 | | - value="DPM", |
143 | | - choices=["PNDM", "LMS", "DDIM", "DPM"], |
144 | | - interactive=False, |
145 | | - visible=False, |
146 | | - ) |
147 | | - device = gr.Radio( |
148 | | - label="Device", |
149 | | - value="vulkan", |
150 | | - choices=["cpu", "cuda", "vulkan"], |
151 | | - interactive=False, |
152 | | - visible=False, |
153 | | - ) |
154 | 159 | iters_count = gr.Slider( |
155 | 160 | 1, |
156 | 161 | 24, |
|
175 | 180 | ) |
176 | 181 | stable_diffusion = gr.Button("Generate Image") |
177 | 182 | with gr.Column(scale=1, min_width=600): |
178 | | - with gr.Row(): |
179 | | - generated_img = gr.Image( |
180 | | - type="pil", elem_id="img_result", interactive=False |
181 | | - ).style(height=768) |
182 | | - std_output = gr.Textbox( |
183 | | - label="Std Output", |
184 | | - value="Nothing.", |
185 | | - lines=5, |
186 | | - visible=False, |
187 | | - ) |
| 183 | + generated_img = gr.Image(type="pil", interactive=False).style( |
| 184 | + height=768 |
| 185 | + ) |
| 186 | + std_output = gr.Textbox( |
| 187 | + label="Std Output", |
| 188 | + value="Loading...", |
| 189 | + lines=5, |
| 190 | + ) |
188 | 191 | debug.change( |
189 | | - lambda x: gr.Textbox.update(visible=x), |
| 192 | + lambda x: gr.update(visible=x), |
190 | 193 | inputs=[debug], |
191 | 194 | outputs=[std_output], |
192 | 195 | ) |
|
0 commit comments