kadirnar commited on
Commit
34895ce
1 Parent(s): d0bcc99

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -40
app.py CHANGED
@@ -267,53 +267,61 @@ 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():
274
  with gr.Column():
 
 
 
 
 
 
 
275
  init_image = gr.Image(label="Input Image", type="pil")
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.Row():
280
- img2img_use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=True)
281
- img2img_negative_prompt = gr.Text(
282
- label="Negative prompt",
283
- max_lines=1,
284
- 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",
285
- visible=True,
 
 
 
 
 
 
 
 
286
  )
287
- img2img_seed = gr.Slider(
288
- label="Seed",
289
- minimum=0,
290
- maximum=MAX_SEED,
291
- step=1,
292
- value=0,
293
- )
294
- img2img_steps = gr.Slider(
295
- label="Steps",
296
- minimum=0,
297
- maximum=60,
298
- step=1,
299
- value=25,
300
- )
301
- img2img_number_image = gr.Slider(
302
- label="Number of Images",
303
- minimum=1,
304
- maximum=4,
305
- step=1,
306
- value=1,
307
- )
308
- img2img_randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
309
- with gr.Row():
310
- img2img_guidance_scale = gr.Slider(
311
- label="Guidance Scale",
312
- minimum=0.1,
313
- maximum=10,
314
- step=0.1,
315
- value=7.0,
316
  )
 
 
 
 
 
 
 
 
 
317
 
318
  img2img_use_negative_prompt.change(
319
  fn=lambda x: gr.update(visible=x),
@@ -324,13 +332,13 @@ with gr.Blocks(css=css) as demo:
324
 
325
  gr.on(
326
  triggers=[
327
- prompt.submit,
328
  img2img_negative_prompt.submit,
329
  run_button.click,
330
  ],
331
  fn=img2img_generate,
332
  inputs=[
333
- prompt,
334
  init_image,
335
  img2img_negative_prompt,
336
  img2img_use_negative_prompt,
@@ -344,7 +352,7 @@ with gr.Blocks(css=css) as demo:
344
  outputs=[img2img_output],
345
  api_name="img2img_run",
346
  )
347
-
348
 
349
  if __name__ == "__main__":
350
  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():
274
  with gr.Column():
275
+ img2img_prompt = gr.Text(
276
+ label="Prompt",
277
+ show_label=False,
278
+ max_lines=1,
279
+ placeholder="Enter your prompt",
280
+ container=False,
281
+ )
282
  init_image = gr.Image(label="Input Image", type="pil")
283
  with gr.Column():
284
  img2img_output = gr.Gallery(label="Result", elem_id="gallery", show_label=False)
285
  strength = gr.Slider(label="Img2Img Strength", minimum=0.0, maximum=1.0, step=0.01, value=0.8)
286
+ with gr.Accordion("Advanced options", open=False):
287
+ with gr.Row():
288
+ img2img_use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=True)
289
+ img2img_negative_prompt = gr.Text(
290
+ label="Negative prompt",
291
+ max_lines=1,
292
+ 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",
293
+ visible=True,
294
+ )
295
+ img2img_seed = gr.Slider(
296
+ label="Seed",
297
+ minimum=0,
298
+ maximum=MAX_SEED,
299
+ step=1,
300
+ value=0,
301
  )
302
+ img2img_steps = gr.Slider(
303
+ label="Steps",
304
+ minimum=0,
305
+ maximum=60,
306
+ step=1,
307
+ value=25,
308
+ )
309
+ img2img_number_image = gr.Slider(
310
+ label="Number of Images",
311
+ minimum=1,
312
+ maximum=4,
313
+ step=1,
314
+ value=1,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  )
316
+ img2img_randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
317
+ with gr.Row():
318
+ img2img_guidance_scale = gr.Slider(
319
+ label="Guidance Scale",
320
+ minimum=0.1,
321
+ maximum=10,
322
+ step=0.1,
323
+ value=7.0,
324
+ )
325
 
326
  img2img_use_negative_prompt.change(
327
  fn=lambda x: gr.update(visible=x),
 
332
 
333
  gr.on(
334
  triggers=[
335
+ img2img_prompt.submit,
336
  img2img_negative_prompt.submit,
337
  run_button.click,
338
  ],
339
  fn=img2img_generate,
340
  inputs=[
341
+ img2img_prompt,
342
  init_image,
343
  img2img_negative_prompt,
344
  img2img_use_negative_prompt,
 
352
  outputs=[img2img_output],
353
  api_name="img2img_run",
354
  )
355
+
356
 
357
  if __name__ == "__main__":
358
  demo.queue().launch()