1inkusFace commited on
Commit
10c7e2c
·
verified ·
1 Parent(s): 7f69ec8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py CHANGED
@@ -185,6 +185,7 @@ def generate_30(
185
  height: int = 768,
186
  guidance_scale: float = 4,
187
  num_inference_steps: int = 125,
 
188
  use_resolution_binning: bool = True,
189
  progress=gr.Progress(track_tqdm=True) # Add progress as a keyword argument
190
  ):
@@ -282,6 +283,9 @@ def generate_30(
282
  prompt_embeds = torch.cat([prompt_embeds, prompt_embeds2],dim=-1)
283
  print('catted combined meaned shape: ', prompt_embeds.shape)
284
 
 
 
 
285
  options = {
286
  #"prompt": prompt,
287
  "prompt_embeds": prompt_embeds,
@@ -320,6 +324,7 @@ def generate_60(
320
  height: int = 768,
321
  guidance_scale: float = 4,
322
  num_inference_steps: int = 125,
 
323
  use_resolution_binning: bool = True,
324
  progress=gr.Progress(track_tqdm=True) # Add progress as a keyword argument
325
  ):
@@ -417,6 +422,9 @@ def generate_60(
417
  prompt_embeds = torch.cat([prompt_embeds, prompt_embeds2],dim=-1)
418
  print('catted combined meaned shape: ', prompt_embeds.shape)
419
 
 
 
 
420
  options = {
421
  #"prompt": prompt,
422
  "prompt_embeds": prompt_embeds,
@@ -455,6 +463,7 @@ def generate_90(
455
  height: int = 768,
456
  guidance_scale: float = 4,
457
  num_inference_steps: int = 125,
 
458
  use_resolution_binning: bool = True,
459
  progress=gr.Progress(track_tqdm=True) # Add progress as a keyword argument
460
  ):
@@ -552,6 +561,9 @@ def generate_90(
552
  prompt_embeds = torch.cat([prompt_embeds, prompt_embeds2],dim=-1)
553
  print('catted combined meaned shape: ', prompt_embeds.shape)
554
 
 
 
 
555
  options = {
556
  #"prompt": prompt,
557
  "prompt_embeds": prompt_embeds,
@@ -650,6 +662,13 @@ with gr.Blocks(theme=gr.themes.Origin(),css=css) as demo:
650
  value="('deformed', 'distorted', 'disfigured':1.3),'not photorealistic':1.5, 'poorly drawn', 'bad anatomy', 'wrong anatomy', 'extra limb', 'missing limb', 'floating limbs', 'poorly drawn hands', 'poorly drawn feet', 'poorly drawn face':1.3, 'out of frame', 'extra limbs', 'bad anatomy', 'bad art', 'beginner', 'distorted face','amateur'",
651
  visible=True,
652
  )
 
 
 
 
 
 
 
653
  with gr.Row():
654
  width = gr.Slider(
655
  label="Width",
@@ -710,6 +729,7 @@ with gr.Blocks(theme=gr.themes.Origin(),css=css) as demo:
710
  height,
711
  guidance_scale,
712
  num_inference_steps,
 
713
  ],
714
  outputs=[result],
715
  )
@@ -730,6 +750,7 @@ with gr.Blocks(theme=gr.themes.Origin(),css=css) as demo:
730
  height,
731
  guidance_scale,
732
  num_inference_steps,
 
733
  ],
734
  outputs=[result],
735
  )
@@ -750,6 +771,7 @@ with gr.Blocks(theme=gr.themes.Origin(),css=css) as demo:
750
  height,
751
  guidance_scale,
752
  num_inference_steps,
 
753
  ],
754
  outputs=[result],
755
  )
 
185
  height: int = 768,
186
  guidance_scale: float = 4,
187
  num_inference_steps: int = 125,
188
+ txt_strength: float = 1.0,
189
  use_resolution_binning: bool = True,
190
  progress=gr.Progress(track_tqdm=True) # Add progress as a keyword argument
191
  ):
 
283
  prompt_embeds = torch.cat([prompt_embeds, prompt_embeds2],dim=-1)
284
  print('catted combined meaned shape: ', prompt_embeds.shape)
285
 
286
+ prompt_embeds = prompt_embeds * txt_strength
287
+ pooled_prompt_embeds = pooled_prompt_embeds * txt_strength
288
+
289
  options = {
290
  #"prompt": prompt,
291
  "prompt_embeds": prompt_embeds,
 
324
  height: int = 768,
325
  guidance_scale: float = 4,
326
  num_inference_steps: int = 125,
327
+ txt_strength: float = 1.0,
328
  use_resolution_binning: bool = True,
329
  progress=gr.Progress(track_tqdm=True) # Add progress as a keyword argument
330
  ):
 
422
  prompt_embeds = torch.cat([prompt_embeds, prompt_embeds2],dim=-1)
423
  print('catted combined meaned shape: ', prompt_embeds.shape)
424
 
425
+ prompt_embeds = prompt_embeds * txt_strength
426
+ pooled_prompt_embeds = pooled_prompt_embeds * txt_strength
427
+
428
  options = {
429
  #"prompt": prompt,
430
  "prompt_embeds": prompt_embeds,
 
463
  height: int = 768,
464
  guidance_scale: float = 4,
465
  num_inference_steps: int = 125,
466
+ txt_strength: float = 1.0,
467
  use_resolution_binning: bool = True,
468
  progress=gr.Progress(track_tqdm=True) # Add progress as a keyword argument
469
  ):
 
561
  prompt_embeds = torch.cat([prompt_embeds, prompt_embeds2],dim=-1)
562
  print('catted combined meaned shape: ', prompt_embeds.shape)
563
 
564
+ prompt_embeds = prompt_embeds * txt_strength
565
+ pooled_prompt_embeds = pooled_prompt_embeds * txt_strength
566
+
567
  options = {
568
  #"prompt": prompt,
569
  "prompt_embeds": prompt_embeds,
 
662
  value="('deformed', 'distorted', 'disfigured':1.3),'not photorealistic':1.5, 'poorly drawn', 'bad anatomy', 'wrong anatomy', 'extra limb', 'missing limb', 'floating limbs', 'poorly drawn hands', 'poorly drawn feet', 'poorly drawn face':1.3, 'out of frame', 'extra limbs', 'bad anatomy', 'bad art', 'beginner', 'distorted face','amateur'",
663
  visible=True,
664
  )
665
+ text_strength = gr.Slider(
666
+ label="Text Strength",
667
+ minimum=0.0,
668
+ maximum=5.0,
669
+ step=0.01,
670
+ value=1.0,
671
+ )
672
  with gr.Row():
673
  width = gr.Slider(
674
  label="Width",
 
729
  height,
730
  guidance_scale,
731
  num_inference_steps,
732
+ text_strength,
733
  ],
734
  outputs=[result],
735
  )
 
750
  height,
751
  guidance_scale,
752
  num_inference_steps,
753
+ text_strength,
754
  ],
755
  outputs=[result],
756
  )
 
771
  height,
772
  guidance_scale,
773
  num_inference_steps,
774
+ text_strength,
775
  ],
776
  outputs=[result],
777
  )