Spaces:
Running
on
Zero
Running
on
Zero
adamelliotfields
commited on
Commit
•
d3b61d3
1
Parent(s):
b074f57
Add scale
Browse files
app.py
CHANGED
@@ -38,7 +38,7 @@ def handle_generate(*args):
|
|
38 |
if prompt is None or prompt.strip() == "":
|
39 |
raise gr.Error("You must enter a prompt")
|
40 |
try:
|
41 |
-
images = generate(*args,
|
42 |
except RuntimeError:
|
43 |
raise gr.Error("RuntimeError: Please try again")
|
44 |
return images
|
@@ -90,32 +90,63 @@ with gr.Blocks(
|
|
90 |
)
|
91 |
|
92 |
model = gr.Dropdown(
|
93 |
-
|
94 |
filterable=False,
|
|
|
95 |
label="Model",
|
96 |
-
choices=cfg.MODELS,
|
97 |
)
|
98 |
|
99 |
with gr.Row():
|
100 |
style = gr.Dropdown(
|
101 |
value=cfg.STYLE,
|
102 |
label="Style",
|
|
|
103 |
choices=[("None", None)]
|
104 |
+ [(style["name"], style["id"]) for style in styles],
|
105 |
)
|
106 |
scheduler = gr.Dropdown(
|
|
|
107 |
value=cfg.SCHEDULER,
|
108 |
elem_id="scheduler",
|
109 |
label="Scheduler",
|
110 |
filterable=False,
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
min_width=200,
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
)
|
114 |
|
115 |
with gr.Row():
|
116 |
guidance_scale = gr.Slider(
|
117 |
value=cfg.GUIDANCE_SCALE,
|
118 |
label="Guidance Scale",
|
|
|
119 |
minimum=1.0,
|
120 |
maximum=15.0,
|
121 |
step=0.1,
|
@@ -134,40 +165,16 @@ with gr.Blocks(
|
|
134 |
maximum=(2**64) - 1,
|
135 |
)
|
136 |
|
137 |
-
with gr.Row():
|
138 |
-
width = gr.Slider(
|
139 |
-
value=cfg.WIDTH,
|
140 |
-
label="Width",
|
141 |
-
minimum=320,
|
142 |
-
maximum=768,
|
143 |
-
step=32,
|
144 |
-
)
|
145 |
-
height = gr.Slider(
|
146 |
-
value=cfg.HEIGHT,
|
147 |
-
label="Height",
|
148 |
-
minimum=320,
|
149 |
-
maximum=768,
|
150 |
-
step=32,
|
151 |
-
)
|
152 |
-
num_images = gr.Dropdown(
|
153 |
-
choices=list(range(1, 5)),
|
154 |
-
value=cfg.NUM_IMAGES,
|
155 |
-
filterable=False,
|
156 |
-
label="Images",
|
157 |
-
)
|
158 |
-
|
159 |
with gr.Row():
|
160 |
use_karras = gr.Checkbox(
|
161 |
elem_classes=["checkbox"],
|
162 |
label="Karras σ",
|
163 |
value=True,
|
164 |
-
scale=1,
|
165 |
)
|
166 |
increment_seed = gr.Checkbox(
|
167 |
elem_classes=["checkbox"],
|
168 |
label="Autoincrement",
|
169 |
value=True,
|
170 |
-
scale=1,
|
171 |
)
|
172 |
|
173 |
with gr.TabItem("🛠️ Advanced"):
|
@@ -226,7 +233,7 @@ with gr.Blocks(
|
|
226 |
columns=2,
|
227 |
)
|
228 |
prompt = gr.Textbox(
|
229 |
-
placeholder="corgi,
|
230 |
show_label=False,
|
231 |
label="Prompt",
|
232 |
value=None,
|
@@ -294,6 +301,7 @@ with gr.Blocks(
|
|
294 |
increment_seed,
|
295 |
deepcache_interval,
|
296 |
tome_ratio,
|
|
|
297 |
],
|
298 |
)
|
299 |
|
|
|
38 |
if prompt is None or prompt.strip() == "":
|
39 |
raise gr.Error("You must enter a prompt")
|
40 |
try:
|
41 |
+
images = generate(*args, Info=gr.Info, Error=gr.Error)
|
42 |
except RuntimeError:
|
43 |
raise gr.Error("RuntimeError: Please try again")
|
44 |
return images
|
|
|
90 |
)
|
91 |
|
92 |
model = gr.Dropdown(
|
93 |
+
choices=cfg.MODELS,
|
94 |
filterable=False,
|
95 |
+
value=cfg.MODEL,
|
96 |
label="Model",
|
|
|
97 |
)
|
98 |
|
99 |
with gr.Row():
|
100 |
style = gr.Dropdown(
|
101 |
value=cfg.STYLE,
|
102 |
label="Style",
|
103 |
+
min_width=200,
|
104 |
choices=[("None", None)]
|
105 |
+ [(style["name"], style["id"]) for style in styles],
|
106 |
)
|
107 |
scheduler = gr.Dropdown(
|
108 |
+
choices=cfg.SCHEDULERS,
|
109 |
value=cfg.SCHEDULER,
|
110 |
elem_id="scheduler",
|
111 |
label="Scheduler",
|
112 |
filterable=False,
|
113 |
+
)
|
114 |
+
|
115 |
+
with gr.Row():
|
116 |
+
width = gr.Slider(
|
117 |
+
value=cfg.WIDTH,
|
118 |
+
label="Width",
|
119 |
min_width=200,
|
120 |
+
minimum=320,
|
121 |
+
maximum=768,
|
122 |
+
step=32,
|
123 |
+
)
|
124 |
+
height = gr.Slider(
|
125 |
+
value=cfg.HEIGHT,
|
126 |
+
label="Height",
|
127 |
+
minimum=320,
|
128 |
+
maximum=768,
|
129 |
+
step=32,
|
130 |
+
)
|
131 |
+
num_images = gr.Dropdown(
|
132 |
+
choices=list(range(1, 5)),
|
133 |
+
value=cfg.NUM_IMAGES,
|
134 |
+
filterable=False,
|
135 |
+
label="Images",
|
136 |
+
)
|
137 |
+
scale = gr.Dropdown(
|
138 |
+
choices=[("1x", 1), ("2x", 2), ("4x", 4), ("8x", 8)],
|
139 |
+
filterable=False,
|
140 |
+
label="Scale",
|
141 |
+
min_width=200,
|
142 |
+
value=1,
|
143 |
)
|
144 |
|
145 |
with gr.Row():
|
146 |
guidance_scale = gr.Slider(
|
147 |
value=cfg.GUIDANCE_SCALE,
|
148 |
label="Guidance Scale",
|
149 |
+
min_width=200,
|
150 |
minimum=1.0,
|
151 |
maximum=15.0,
|
152 |
step=0.1,
|
|
|
165 |
maximum=(2**64) - 1,
|
166 |
)
|
167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
with gr.Row():
|
169 |
use_karras = gr.Checkbox(
|
170 |
elem_classes=["checkbox"],
|
171 |
label="Karras σ",
|
172 |
value=True,
|
|
|
173 |
)
|
174 |
increment_seed = gr.Checkbox(
|
175 |
elem_classes=["checkbox"],
|
176 |
label="Autoincrement",
|
177 |
value=True,
|
|
|
178 |
)
|
179 |
|
180 |
with gr.TabItem("🛠️ Advanced"):
|
|
|
233 |
columns=2,
|
234 |
)
|
235 |
prompt = gr.Textbox(
|
236 |
+
placeholder="corgi, beach, 8k",
|
237 |
show_label=False,
|
238 |
label="Prompt",
|
239 |
value=None,
|
|
|
301 |
increment_seed,
|
302 |
deepcache_interval,
|
303 |
tome_ratio,
|
304 |
+
scale,
|
305 |
],
|
306 |
)
|
307 |
|
cli.py
CHANGED
@@ -24,6 +24,7 @@ def main():
|
|
24 |
parser.add_argument("-h", "--height", type=int, metavar="INT", default=cfg.HEIGHT)
|
25 |
parser.add_argument("-m", "--model", type=str, metavar="STR", default=cfg.MODEL)
|
26 |
parser.add_argument("-d", "--deepcache", type=int, metavar="INT", default=cfg.DEEPCACHE_INTERVAL)
|
|
|
27 |
parser.add_argument("--style", type=str, metavar="STR", default=cfg.STYLE)
|
28 |
parser.add_argument("--scheduler", type=str, metavar="STR", default=cfg.SCHEDULER)
|
29 |
parser.add_argument("--guidance", type=float, metavar="FLOAT", default=cfg.GUIDANCE_SCALE)
|
@@ -56,6 +57,7 @@ def main():
|
|
56 |
args.no_increment,
|
57 |
args.deepcache,
|
58 |
args.tome,
|
|
|
59 |
)
|
60 |
save_images(images, args.filename)
|
61 |
|
|
|
24 |
parser.add_argument("-h", "--height", type=int, metavar="INT", default=cfg.HEIGHT)
|
25 |
parser.add_argument("-m", "--model", type=str, metavar="STR", default=cfg.MODEL)
|
26 |
parser.add_argument("-d", "--deepcache", type=int, metavar="INT", default=cfg.DEEPCACHE_INTERVAL)
|
27 |
+
parser.add_argument("--scale", type=int, metavar="INT", default=1)
|
28 |
parser.add_argument("--style", type=str, metavar="STR", default=cfg.STYLE)
|
29 |
parser.add_argument("--scheduler", type=str, metavar="STR", default=cfg.SCHEDULER)
|
30 |
parser.add_argument("--guidance", type=float, metavar="FLOAT", default=cfg.GUIDANCE_SCALE)
|
|
|
57 |
args.no_increment,
|
58 |
args.deepcache,
|
59 |
args.tome,
|
60 |
+
args.scale,
|
61 |
)
|
62 |
save_images(images, args.filename)
|
63 |
|