linoyts HF staff commited on
Commit
a7f8c35
1 Parent(s): 6c3a5d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -28
app.py CHANGED
@@ -182,9 +182,6 @@ def run(
182
  use_hed: bool = False,
183
  progress=gr.Progress(track_tqdm=True),
184
  ) -> PIL.Image.Image:
185
- # image = image.convert("RGB")
186
- # image = TF.to_tensor(image) > 0.5
187
- # image = TF.to_pil_image(image.to(torch.float32))
188
  width, height = image['composite'].size
189
  ratio = np.sqrt(1024. * 1024. / (width * height))
190
  new_width, new_height = int(width * ratio), int(height * ratio)
@@ -243,7 +240,7 @@ with gr.Blocks(css="style.css", js=js_func) as demo:
243
  with gr.Accordion("Advanced options", open=False):
244
  negative_prompt = gr.Textbox(
245
  label="Negative prompt",
246
- value=" extra digit, fewer digits, cropped, worst quality, low quality, glitch, deformed, mutated, ugly, disfigured",
247
  )
248
  num_steps = gr.Slider(
249
  label="Number of steps",
@@ -278,9 +275,7 @@ with gr.Blocks(css="style.css", js=js_func) as demo:
278
  with gr.Column():
279
  with gr.Group():
280
  image_slider = ImageSlider(position=0.5)
281
- # with gr.Row():
282
- # result = gr.Image(label="result", height=400)
283
- # sketch_image = gr.Image(label="sketch")
284
 
285
  inputs = [
286
  image,
@@ -294,34 +289,16 @@ with gr.Blocks(css="style.css", js=js_func) as demo:
294
  use_hed,
295
  ]
296
  outputs = [image_slider]
297
- run_button.click(lambda x: None, inputs=None, outputs=image_slider).then(
298
- fn=run, inputs=inputs, outputs=outputs
299
- )
300
-
301
- prompt.submit(
302
  fn=randomize_seed_fn,
303
  inputs=[seed, randomize_seed],
304
  outputs=seed,
305
  queue=False,
306
  api_name=False,
307
  ).then(lambda x: None, inputs=None, outputs=image_slider).then(
308
- fn=run,
309
- inputs=inputs,
310
- outputs=outputs,
311
- api_name=False,
312
- )
313
- negative_prompt.submit(
314
- fn=randomize_seed_fn,
315
- inputs=[seed, randomize_seed],
316
- outputs=seed,
317
- queue=False,
318
- api_name=False,
319
- ).then(lambda x: None, inputs=None, outputs=image_slider).then(
320
- fn=run,
321
- inputs=inputs,
322
- outputs=outputs,
323
- api_name=False,
324
  )
325
 
 
326
 
327
  demo.queue().launch()
 
182
  use_hed: bool = False,
183
  progress=gr.Progress(track_tqdm=True),
184
  ) -> PIL.Image.Image:
 
 
 
185
  width, height = image['composite'].size
186
  ratio = np.sqrt(1024. * 1024. / (width * height))
187
  new_width, new_height = int(width * ratio), int(height * ratio)
 
240
  with gr.Accordion("Advanced options", open=False):
241
  negative_prompt = gr.Textbox(
242
  label="Negative prompt",
243
+ value="longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
244
  )
245
  num_steps = gr.Slider(
246
  label="Number of steps",
 
275
  with gr.Column():
276
  with gr.Group():
277
  image_slider = ImageSlider(position=0.5)
278
+
 
 
279
 
280
  inputs = [
281
  image,
 
289
  use_hed,
290
  ]
291
  outputs = [image_slider]
292
+ run_button.click(
 
 
 
 
293
  fn=randomize_seed_fn,
294
  inputs=[seed, randomize_seed],
295
  outputs=seed,
296
  queue=False,
297
  api_name=False,
298
  ).then(lambda x: None, inputs=None, outputs=image_slider).then(
299
+ fn=run, inputs=inputs, outputs=outputs
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  )
301
 
302
+
303
 
304
  demo.queue().launch()