Spaces:
Running
on
Zero
Running
on
Zero
Alexander Bagus
commited on
Commit
·
b22119d
1
Parent(s):
2ef6e7d
22
Browse files
app.py
CHANGED
|
@@ -88,94 +88,92 @@ with gr.Blocks() as demo:
|
|
| 88 |
with gr.Column(elem_id="col-container"):
|
| 89 |
with gr.Column():
|
| 90 |
gr.HTML(read_file("static/header.html"))
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
|
| 150 |
|
| 151 |
-
|
| 152 |
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
|
| 157 |
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
# outputs=[output_image, seed],
|
| 178 |
-
# )
|
| 179 |
|
| 180 |
|
| 181 |
if __name__ == "__main__":
|
|
|
|
| 88 |
with gr.Column(elem_id="col-container"):
|
| 89 |
with gr.Column():
|
| 90 |
gr.HTML(read_file("static/header.html"))
|
| 91 |
+
with gr.Row():
|
| 92 |
+
with gr.Column():
|
| 93 |
+
prompt = gr.Textbox(
|
| 94 |
+
label="Prompt",
|
| 95 |
+
show_label=False,
|
| 96 |
+
lines=2,
|
| 97 |
+
placeholder="Enter your prompt",
|
| 98 |
+
# container=False,
|
| 99 |
+
)
|
| 100 |
+
is_polish_prompt = gr.Checkbox(label="Polish prompt", value=False)
|
| 101 |
+
run_button = gr.Button("Generate", variant="primary")
|
| 102 |
+
with gr.Accordion("Advanced Settings", open=False):
|
| 103 |
|
| 104 |
+
negative_prompt = gr.Textbox(
|
| 105 |
+
label="Negative prompt",
|
| 106 |
+
lines=2,
|
| 107 |
+
container=False,
|
| 108 |
+
placeholder="Enter your negative prompt",
|
| 109 |
+
value="blurry ugly bad"
|
| 110 |
+
)
|
| 111 |
+
num_inference_steps = gr.Slider(
|
| 112 |
+
label="Steps",
|
| 113 |
+
minimum=1,
|
| 114 |
+
maximum=50,
|
| 115 |
+
step=1,
|
| 116 |
+
value=20,
|
| 117 |
+
)
|
| 118 |
+
with gr.Row():
|
| 119 |
+
width = gr.Slider(
|
| 120 |
+
label="Width",
|
| 121 |
+
minimum=512,
|
| 122 |
+
maximum=1280,
|
| 123 |
+
step=32,
|
| 124 |
+
value=768,
|
| 125 |
+
)
|
| 126 |
+
|
| 127 |
+
height = gr.Slider(
|
| 128 |
+
label="Height",
|
| 129 |
+
minimum=512,
|
| 130 |
+
maximum=1280,
|
| 131 |
+
step=32,
|
| 132 |
+
value=1024,
|
| 133 |
+
)
|
| 134 |
+
with gr.Row():
|
| 135 |
+
seed = gr.Slider(
|
| 136 |
+
label="Seed",
|
| 137 |
+
minimum=0,
|
| 138 |
+
maximum=MAX_SEED,
|
| 139 |
+
step=1,
|
| 140 |
+
value=42,
|
| 141 |
+
)
|
| 142 |
+
guidance_scale = gr.Slider(
|
| 143 |
+
label="Guidance scale",
|
| 144 |
+
minimum=0.0,
|
| 145 |
+
maximum=10.0,
|
| 146 |
+
step=0.1,
|
| 147 |
+
value=1.0,
|
| 148 |
+
)
|
| 149 |
|
| 150 |
|
| 151 |
+
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
| 152 |
|
| 153 |
+
with gr.Column():
|
| 154 |
+
output_image = gr.Image(label="Generated image", show_label=False)
|
| 155 |
+
polished_prompt = gr.Textbox(label="Final prompt",lines=2, interactive=False)
|
| 156 |
|
| 157 |
|
| 158 |
+
gr.Examples(examples=examples, inputs=[prompt])
|
| 159 |
+
gr.Markdown(read_file("static/footer.md"))
|
| 160 |
+
|
| 161 |
+
run_button.click(
|
| 162 |
+
fn=inference,
|
| 163 |
+
inputs=[
|
| 164 |
+
prompt,
|
| 165 |
+
negative_prompt,
|
| 166 |
+
width,
|
| 167 |
+
height,
|
| 168 |
+
seed,
|
| 169 |
+
randomize_seed,
|
| 170 |
+
guidance_scale,
|
| 171 |
+
num_inference_steps,
|
| 172 |
+
],
|
| 173 |
+
outputs=[output_image, seed],
|
| 174 |
+
).then(
|
| 175 |
+
|
| 176 |
+
)
|
|
|
|
|
|
|
| 177 |
|
| 178 |
|
| 179 |
if __name__ == "__main__":
|