JingyeChen22 commited on
Commit
cc5a880
Β·
1 Parent(s): 913e917

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -484,7 +484,7 @@ def text_to_image(prompt,slider_step,slider_guidance,slider_batch, version):
484
  text_encoder = text_encoder21
485
  tokenizer = tokenizer21
486
  scheduler = scheduler21
487
- slider_batch = min(slider_batch, 2)
488
  size = 768
489
  elif version == 'Stable Diffusion v1.5':
490
  vae = vae15
@@ -612,7 +612,7 @@ def text_to_image_with_template(prompt,template_image,slider_step,slider_guidanc
612
  text_encoder = text_encoder21
613
  tokenizer = tokenizer21
614
  scheduler = scheduler21
615
- slider_batch = min(slider_batch, 2)
616
  size = 768
617
  elif version == 'Stable Diffusion v1.5':
618
  vae = vae15
@@ -736,7 +736,7 @@ def text_inpainting(prompt,orig_image,mask_image,slider_step,slider_guidance,sli
736
  text_encoder = text_encoder21
737
  tokenizer = tokenizer21
738
  scheduler = scheduler21
739
- slider_batch = min(slider_batch, 2)
740
  size = 768
741
  elif version == 'Stable Diffusion v1.5':
742
  vae = vae15
@@ -906,7 +906,7 @@ with gr.Blocks() as demo:
906
  radio = gr.Radio(["Stable Diffusion v2.1", "Stable Diffusion v1.5"], label="Pre-trained Model", value="Stable Diffusion v2.1")
907
  slider_step = gr.Slider(minimum=1, maximum=50, value=20, step=1, label="Sampling step", info="The sampling step for TextDiffuser.")
908
  slider_guidance = gr.Slider(minimum=1, maximum=9, value=7.5, step=0.5, label="Scale of classifier-free guidance", info="The scale of classifier-free guidance and is set to 7.5 in default.")
909
- slider_batch = gr.Slider(minimum=1, maximum=4, value=4, step=1, label="Batch size", info="The number of images to be sampled. Maximum number is set to 【2】 for SD v2.1 to avoid OOM.")
910
  # slider_seed = gr.Slider(minimum=1, maximum=10000, label="Seed", randomize=True)
911
  button = gr.Button("Generate")
912
 
@@ -957,7 +957,7 @@ with gr.Blocks() as demo:
957
  radio = gr.Radio(["Stable Diffusion v2.1", "Stable Diffusion v1.5"], label="Pre-trained Model", value="Stable Diffusion v2.1")
958
  slider_step = gr.Slider(minimum=1, maximum=50, value=20, step=1, label="Sampling step", info="The sampling step for TextDiffuser.")
959
  slider_guidance = gr.Slider(minimum=1, maximum=9, value=7.5, step=0.5, label="Scale of classifier-free guidance", info="The scale of classifier-free guidance and is set to 7.5 in default.")
960
- slider_batch = gr.Slider(minimum=1, maximum=4, value=4, step=1, label="Batch size", info="The number of images to be sampled. Maximum number is set to 【2】 for SD v2.1 to avoid OOM.")
961
  # binary = gr.Radio(["park", "zoo", "road"], label="Location", info="Where did they go?")
962
  binary = gr.Checkbox(label="Binarization", bool=True, info="Whether to binarize the template image? You may need it when using handwritten images as templates.")
963
  button = gr.Button("Generate")
@@ -1007,7 +1007,7 @@ with gr.Blocks() as demo:
1007
  radio = gr.Radio(["Stable Diffusion v2.1", "Stable Diffusion v1.5"], label="Pre-trained Model", value="Stable Diffusion v2.1")
1008
  slider_step = gr.Slider(minimum=1, maximum=50, value=20, step=1, label="Sampling step", info="The sampling step for TextDiffuser.")
1009
  slider_guidance = gr.Slider(minimum=1, maximum=9, value=7.5, step=0.5, label="Scale of classifier-free guidance", info="The scale of classifier-free guidance and is set to 7.5 in default.")
1010
- slider_batch = gr.Slider(minimum=1, maximum=4, value=4, step=1, label="Batch size", info="The number of images to be sampled. Maximum number is set to 【2】 for SD v2.1 to avoid OOM.")
1011
  button = gr.Button("Generate")
1012
  with gr.Column(scale=1):
1013
  output = gr.Image(label='Generated image')
 
484
  text_encoder = text_encoder21
485
  tokenizer = tokenizer21
486
  scheduler = scheduler21
487
+ slider_batch = min(slider_batch, 1)
488
  size = 768
489
  elif version == 'Stable Diffusion v1.5':
490
  vae = vae15
 
612
  text_encoder = text_encoder21
613
  tokenizer = tokenizer21
614
  scheduler = scheduler21
615
+ slider_batch = min(slider_batch, 1)
616
  size = 768
617
  elif version == 'Stable Diffusion v1.5':
618
  vae = vae15
 
736
  text_encoder = text_encoder21
737
  tokenizer = tokenizer21
738
  scheduler = scheduler21
739
+ slider_batch = min(slider_batch, 1)
740
  size = 768
741
  elif version == 'Stable Diffusion v1.5':
742
  vae = vae15
 
906
  radio = gr.Radio(["Stable Diffusion v2.1", "Stable Diffusion v1.5"], label="Pre-trained Model", value="Stable Diffusion v2.1")
907
  slider_step = gr.Slider(minimum=1, maximum=50, value=20, step=1, label="Sampling step", info="The sampling step for TextDiffuser.")
908
  slider_guidance = gr.Slider(minimum=1, maximum=9, value=7.5, step=0.5, label="Scale of classifier-free guidance", info="The scale of classifier-free guidance and is set to 7.5 in default.")
909
+ slider_batch = gr.Slider(minimum=1, maximum=4, value=4, step=1, label="Batch size", info="The number of images to be sampled. Maximum number is set to 1 for SD v2.1 to avoid OOM.")
910
  # slider_seed = gr.Slider(minimum=1, maximum=10000, label="Seed", randomize=True)
911
  button = gr.Button("Generate")
912
 
 
957
  radio = gr.Radio(["Stable Diffusion v2.1", "Stable Diffusion v1.5"], label="Pre-trained Model", value="Stable Diffusion v2.1")
958
  slider_step = gr.Slider(minimum=1, maximum=50, value=20, step=1, label="Sampling step", info="The sampling step for TextDiffuser.")
959
  slider_guidance = gr.Slider(minimum=1, maximum=9, value=7.5, step=0.5, label="Scale of classifier-free guidance", info="The scale of classifier-free guidance and is set to 7.5 in default.")
960
+ slider_batch = gr.Slider(minimum=1, maximum=4, value=4, step=1, label="Batch size", info="The number of images to be sampled. Maximum number is set to 1 for SD v2.1 to avoid OOM.")
961
  # binary = gr.Radio(["park", "zoo", "road"], label="Location", info="Where did they go?")
962
  binary = gr.Checkbox(label="Binarization", bool=True, info="Whether to binarize the template image? You may need it when using handwritten images as templates.")
963
  button = gr.Button("Generate")
 
1007
  radio = gr.Radio(["Stable Diffusion v2.1", "Stable Diffusion v1.5"], label="Pre-trained Model", value="Stable Diffusion v2.1")
1008
  slider_step = gr.Slider(minimum=1, maximum=50, value=20, step=1, label="Sampling step", info="The sampling step for TextDiffuser.")
1009
  slider_guidance = gr.Slider(minimum=1, maximum=9, value=7.5, step=0.5, label="Scale of classifier-free guidance", info="The scale of classifier-free guidance and is set to 7.5 in default.")
1010
+ slider_batch = gr.Slider(minimum=1, maximum=4, value=4, step=1, label="Batch size", info="The number of images to be sampled. Maximum number is set to 1 for SD v2.1 to avoid OOM.")
1011
  button = gr.Button("Generate")
1012
  with gr.Column(scale=1):
1013
  output = gr.Image(label='Generated image')