Krebzonide
commited on
Commit
·
75f237b
1
Parent(s):
7e19ced
Update app.py
Browse files
app.py
CHANGED
@@ -68,6 +68,9 @@ def set_base_model(base_model_id):
|
|
68 |
)
|
69 |
pipe.to("cuda")
|
70 |
return pipe
|
|
|
|
|
|
|
71 |
|
72 |
with gr.Blocks(css=css) as demo:
|
73 |
with gr.Column():
|
@@ -79,11 +82,16 @@ with gr.Blocks(css=css) as demo:
|
|
79 |
guide_scale = gr.Slider(1, 6, value=3, step=0.5, label="Guidance scale")
|
80 |
batch_size = gr.Slider(1, 6, value=1, step=1, label="Batch size")
|
81 |
with gr.Row():
|
82 |
-
seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=999999, step=1)
|
83 |
height = gr.Slider(label="Height", value=1024, minimum=512, maximum=2048, step=16)
|
84 |
width = gr.Slider(label="Width", value=1024, minimum=512, maximum=2048, step=16)
|
|
|
|
|
|
|
85 |
gallery = gr.Gallery(label="Generated images", height=800)
|
86 |
submit_btn.click(generate, [prompt, negative_prompt, samp_steps, guide_scale, batch_size, seed, height, width], [gallery], queue=True)
|
|
|
|
|
|
|
87 |
|
88 |
pipe = set_base_model(model_id)
|
89 |
demo.launch(debug=True)
|
|
|
68 |
)
|
69 |
pipe.to("cuda")
|
70 |
return pipe
|
71 |
+
|
72 |
+
def update_pixel_ratio(height, width):
|
73 |
+
return round(height*width/1048576,3)
|
74 |
|
75 |
with gr.Blocks(css=css) as demo:
|
76 |
with gr.Column():
|
|
|
82 |
guide_scale = gr.Slider(1, 6, value=3, step=0.5, label="Guidance scale")
|
83 |
batch_size = gr.Slider(1, 6, value=1, step=1, label="Batch size")
|
84 |
with gr.Row():
|
|
|
85 |
height = gr.Slider(label="Height", value=1024, minimum=512, maximum=2048, step=16)
|
86 |
width = gr.Slider(label="Width", value=1024, minimum=512, maximum=2048, step=16)
|
87 |
+
with gr.Row():
|
88 |
+
pixels = gr.Number(label="Pixel Ratio", value=1, interactive=False)
|
89 |
+
seed = gr.Number(label="Seed", value=-1, minimum=-1, precision=0)
|
90 |
gallery = gr.Gallery(label="Generated images", height=800)
|
91 |
submit_btn.click(generate, [prompt, negative_prompt, samp_steps, guide_scale, batch_size, seed, height, width], [gallery], queue=True)
|
92 |
+
height.change(update_pixel_ratio, [height, width], [pixels], queue=False)
|
93 |
+
width.change(update_pixel_ratio, [height, width], [pixels], queue=False)
|
94 |
+
|
95 |
|
96 |
pipe = set_base_model(model_id)
|
97 |
demo.launch(debug=True)
|