Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -267,7 +267,7 @@ with gr.Blocks(css=css) as demo:
|
|
267 |
outputs=[result],
|
268 |
api_name="run",
|
269 |
)
|
270 |
-
|
271 |
with gr.TabItem("Image to Image"):
|
272 |
with gr.Group():
|
273 |
with gr.Row():
|
@@ -276,29 +276,76 @@ with gr.Blocks(css=css) as demo:
|
|
276 |
with gr.Column():
|
277 |
img2img_output = gr.Gallery(label="Result", elem_id="gallery", show_label=False)
|
278 |
strength = gr.Slider(label="Img2Img Strength", minimum=0.0, maximum=1.0, step=0.01, value=0.8)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
gr.on(
|
281 |
triggers=[
|
282 |
prompt.submit,
|
283 |
-
|
284 |
run_button.click,
|
285 |
],
|
286 |
fn=img2img_generate,
|
287 |
inputs=[
|
288 |
prompt,
|
289 |
init_image,
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
strength,
|
297 |
-
|
298 |
],
|
299 |
outputs=[img2img_output],
|
300 |
api_name="img2img_run",
|
301 |
)
|
302 |
|
|
|
303 |
if __name__ == "__main__":
|
304 |
demo.queue().launch()
|
|
|
267 |
outputs=[result],
|
268 |
api_name="run",
|
269 |
)
|
270 |
+
|
271 |
with gr.TabItem("Image to Image"):
|
272 |
with gr.Group():
|
273 |
with gr.Row():
|
|
|
276 |
with gr.Column():
|
277 |
img2img_output = gr.Gallery(label="Result", elem_id="gallery", show_label=False)
|
278 |
strength = gr.Slider(label="Img2Img Strength", minimum=0.0, maximum=1.0, step=0.01, value=0.8)
|
279 |
+
with gr.Accordion("Advanced options", open=False):
|
280 |
+
with gr.Row():
|
281 |
+
img2img_use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=True)
|
282 |
+
img2img_negative_prompt = gr.Text(
|
283 |
+
label="Negative prompt",
|
284 |
+
max_lines=1,
|
285 |
+
value="deformed, distorted, disfigured, poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, mutated hands and fingers, disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation, NSFW",
|
286 |
+
visible=True,
|
287 |
+
)
|
288 |
+
img2img_seed = gr.Slider(
|
289 |
+
label="Seed",
|
290 |
+
minimum=0,
|
291 |
+
maximum=MAX_SEED,
|
292 |
+
step=1,
|
293 |
+
value=0,
|
294 |
+
)
|
295 |
+
img2img_steps = gr.Slider(
|
296 |
+
label="Steps",
|
297 |
+
minimum=0,
|
298 |
+
maximum=60,
|
299 |
+
step=1,
|
300 |
+
value=25,
|
301 |
+
)
|
302 |
+
img2img_number_image = gr.Slider(
|
303 |
+
label="Number of Images",
|
304 |
+
minimum=1,
|
305 |
+
maximum=4,
|
306 |
+
step=1,
|
307 |
+
value=1,
|
308 |
+
)
|
309 |
+
img2img_randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
310 |
+
with gr.Row():
|
311 |
+
img2img_guidance_scale = gr.Slider(
|
312 |
+
label="Guidance Scale",
|
313 |
+
minimum=0.1,
|
314 |
+
maximum=10,
|
315 |
+
step=0.1,
|
316 |
+
value=7.0,
|
317 |
+
)
|
318 |
|
319 |
+
img2img_use_negative_prompt.change(
|
320 |
+
fn=lambda x: gr.update(visible=x),
|
321 |
+
inputs=img2img_use_negative_prompt,
|
322 |
+
outputs=img2img_negative_prompt,
|
323 |
+
api_name=False,
|
324 |
+
)
|
325 |
+
|
326 |
gr.on(
|
327 |
triggers=[
|
328 |
prompt.submit,
|
329 |
+
img2img_negative_prompt.submit,
|
330 |
run_button.click,
|
331 |
],
|
332 |
fn=img2img_generate,
|
333 |
inputs=[
|
334 |
prompt,
|
335 |
init_image,
|
336 |
+
img2img_negative_prompt,
|
337 |
+
img2img_use_negative_prompt,
|
338 |
+
img2img_seed,
|
339 |
+
img2img_guidance_scale,
|
340 |
+
img2img_randomize_seed,
|
341 |
+
img2img_steps,
|
342 |
strength,
|
343 |
+
img2img_number_image,
|
344 |
],
|
345 |
outputs=[img2img_output],
|
346 |
api_name="img2img_run",
|
347 |
)
|
348 |
|
349 |
+
|
350 |
if __name__ == "__main__":
|
351 |
demo.queue().launch()
|