Spaces:
Running
on
Zero
Running
on
Zero
QoL PR (#3)
Browse files- QoL PR (6cb6b7696af54b19bf7e28b0d2d7485e100732ac)
- Update app.py (7b4114bf55a748cbd510297e4aaa59314169e54c)
Co-authored-by: yuvraj sharma <[email protected]>
app.py
CHANGED
|
@@ -116,59 +116,91 @@ def get_image(height, width, seed, prompt, cfg, timesteps, stage_a_tiled):
|
|
| 116 |
|
| 117 |
|
| 118 |
with gr.Blocks() as demo:
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
with gr.Row():
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
stage_a_tiled = gr.Checkbox(value=False, label='Stage_a_tiled')
|
| 129 |
-
with gr.Row():
|
| 130 |
-
clear_button = gr.Button("Clear!")
|
| 131 |
-
polish_button = gr.Button("Submit!")
|
| 132 |
-
with gr.Column():
|
| 133 |
-
output_img = gr.Image(label='Output Image', sources=None)
|
| 134 |
-
with gr.Column():
|
| 135 |
-
prompt2 = gr.Textbox(
|
| 136 |
-
value='''
|
| 137 |
-
A detailed view of a blooming magnolia tree, with large, white flowers and dark green leaves, set against a
|
| 138 |
-
clear blue sky.
|
| 139 |
-
|
| 140 |
-
A close-up portrait of a young woman with flawless skin, vibrant red lipstick, and wavy brown hair, wearing
|
| 141 |
-
a vintage floral dress and standing in front of a blooming garden.
|
| 142 |
-
|
| 143 |
-
The image features a snow-covered mountain range with a large, snow-covered mountain in the background.
|
| 144 |
-
The mountain is surrounded by a forest of trees, and the sky is filled with clouds. The scene is set during the
|
| 145 |
-
winter season, with snow covering the ground and the trees.
|
| 146 |
-
|
| 147 |
-
Crocodile in a sweater.
|
| 148 |
-
|
| 149 |
-
A vibrant anime scene of a young girl with long, flowing pink hair, big sparkling blue eyes, and a school
|
| 150 |
-
uniform, standing under a cherry blossom tree with petals falling around her. The background shows a
|
| 151 |
-
traditional Japanese school with cherry blossoms in full bloom.
|
| 152 |
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
|
| 169 |
polish_button.click(get_image, inputs=[height, width, seed, prompt, cfg, timesteps, stage_a_tiled], outputs=output_img)
|
| 170 |
polish_button.click(clear_image, inputs=[], outputs=output_img)
|
| 171 |
-
|
|
|
|
| 172 |
if __name__ == "__main__":
|
| 173 |
|
| 174 |
args = parse_args()
|
|
|
|
| 116 |
|
| 117 |
|
| 118 |
with gr.Blocks() as demo:
|
| 119 |
+
with gr.Column(elem_id="col-container"):
|
| 120 |
+
gr.Markdown("<h1><center>UltraPixel: Advancing Ultra-High-Resolution Image Synthesis to New Peaks </center></h1>")
|
| 121 |
+
|
| 122 |
+
with gr.Row():
|
| 123 |
+
prompt = gr.Textbox(
|
| 124 |
+
label="Text Prompt",
|
| 125 |
+
show_label=False,
|
| 126 |
+
max_lines=1,
|
| 127 |
+
placeholder="Enter your prompt",
|
| 128 |
+
container=False
|
| 129 |
+
)
|
| 130 |
+
polish_button = gr.Button("Submit!", scale=0)
|
| 131 |
+
|
| 132 |
+
output_img = gr.Image(label="Output Image", show_label=False)
|
| 133 |
+
|
| 134 |
+
with gr.Accordion("Advanced Settings", open=False):
|
| 135 |
+
seed = gr.Number(
|
| 136 |
+
label="Random Seed",
|
| 137 |
+
value=123,
|
| 138 |
+
step=1,
|
| 139 |
+
minimum=0,
|
| 140 |
+
#maximum=MAX_SEED
|
| 141 |
+
)
|
| 142 |
+
|
| 143 |
+
#randomize_seed = gr.Checkbox(label="Randomize seed", value=False)
|
| 144 |
+
|
| 145 |
with gr.Row():
|
| 146 |
+
width = gr.Slider(
|
| 147 |
+
label="Width",
|
| 148 |
+
minimum=1536,
|
| 149 |
+
maximum=5120,
|
| 150 |
+
step=32,
|
| 151 |
+
value=4096
|
| 152 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
|
| 154 |
+
height = gr.Slider(
|
| 155 |
+
label="Height",
|
| 156 |
+
minimum=1536,
|
| 157 |
+
maximum=4096,
|
| 158 |
+
step=32,
|
| 159 |
+
value=2304
|
| 160 |
+
)
|
| 161 |
+
|
| 162 |
+
with gr.Row():
|
| 163 |
+
cfg = gr.Slider(
|
| 164 |
+
label="CFG",
|
| 165 |
+
minimum=3,
|
| 166 |
+
maximum=10,
|
| 167 |
+
step=0.1,
|
| 168 |
+
value=4
|
| 169 |
+
)
|
| 170 |
|
| 171 |
+
timesteps = gr.Slider(
|
| 172 |
+
label="Timesteps",
|
| 173 |
+
minimum=10,
|
| 174 |
+
maximum=50,
|
| 175 |
+
step=1,
|
| 176 |
+
value=20
|
| 177 |
+
)
|
| 178 |
+
|
| 179 |
+
stage_a_tiled = gr.Checkbox(label="Stage_a_tiled", value=False)
|
| 180 |
+
|
| 181 |
+
clear_button = gr.Button("Clear!")
|
| 182 |
+
|
| 183 |
+
gr.Examples(
|
| 184 |
+
examples=[
|
| 185 |
+
"A detailed view of a blooming magnolia tree, with large, white flowers and dark green leaves, set against a clear blue sky.",
|
| 186 |
+
"A close-up portrait of a young woman with flawless skin, vibrant red lipstick, and wavy brown hair, wearing a vintage floral dress and standing in front of a blooming garden.",
|
| 187 |
+
"The image features a snow-covered mountain range with a large, snow-covered mountain in the background. The mountain is surrounded by a forest of trees, and the sky is filled with clouds. The scene is set during the winter season, with snow covering the ground and the trees.",
|
| 188 |
+
"Crocodile in a sweater.",
|
| 189 |
+
"A vibrant anime scene of a young girl with long, flowing pink hair, big sparkling blue eyes, and a school uniform, standing under a cherry blossom tree with petals falling around her. The background shows a traditional Japanese school with cherry blossoms in full bloom.",
|
| 190 |
+
"A playful Labrador retriever puppy with a shiny, golden coat, chasing a red ball in a spacious backyard, with green grass and a wooden fence.",
|
| 191 |
+
"A cozy, rustic log cabin nestled in a snow-covered forest, with smoke rising from the stone chimney, warm lights glowing from the windows, and a path of footprints leading to the front door.",
|
| 192 |
+
"A highly detailed, high-quality image of the Banff National Park in Canada. The turquoise waters of Lake Louise are surrounded by snow-capped mountains and dense pine forests. A wooden canoe is docked at the edge of the lake. The sky is a clear, bright blue, and the air is crisp and fresh.",
|
| 193 |
+
"A highly detailed, high-quality image of a Shih Tzu receiving a bath in a home bathroom. The dog is standing in a tub, covered in suds, with a slightly wet and adorable look. The background includes bathroom fixtures, towels, and a clean, tiled floor.",
|
| 194 |
+
],
|
| 195 |
+
inputs=[prompt],
|
| 196 |
+
outputs=[output_img],
|
| 197 |
+
examples_per_page=5
|
| 198 |
+
)
|
| 199 |
|
| 200 |
polish_button.click(get_image, inputs=[height, width, seed, prompt, cfg, timesteps, stage_a_tiled], outputs=output_img)
|
| 201 |
polish_button.click(clear_image, inputs=[], outputs=output_img)
|
| 202 |
+
|
| 203 |
+
|
| 204 |
if __name__ == "__main__":
|
| 205 |
|
| 206 |
args = parse_args()
|