1inkusFace commited on
Commit
ae21228
·
verified ·
1 Parent(s): db32f90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -122,6 +122,7 @@ def load_and_prepare_model():
122
  text_encoder=None,
123
  text_encoder_2=None,
124
  vae=None,
 
125
  )
126
 
127
  '''
@@ -294,7 +295,7 @@ def expand_prompt(prompt):
294
  outputs = model.generate(
295
  input_ids=input_ids,
296
  attention_mask=attention_mask,
297
- max_new_tokens=384,
298
  temperature=0.2,
299
  top_p=0.9,
300
  do_sample=True,
@@ -307,7 +308,7 @@ def expand_prompt(prompt):
307
  outputs_2 = model.generate(
308
  input_ids=input_ids_2,
309
  attention_mask=attention_mask_2,
310
- max_new_tokens=384,
311
  temperature=0.2,
312
  top_p=0.9,
313
  do_sample=True,
@@ -411,6 +412,8 @@ def generate_30(
411
  expand_prompt(prompt)
412
  expand_prompt(caption)
413
  expanded = expand_prompt(caption_2)
 
 
414
  del model
415
  del txt_tokenizer
416
  gc.collect()
@@ -426,8 +429,8 @@ def generate_30(
426
  pil_image_3=sd_image_c,
427
  pil_image_4=sd_image_d,
428
  pil_image_5=sd_image_e,
429
- prompt=prompt,
430
- prompt_2=expanded,
431
  negative_prompt=negative_prompt,
432
  text_scale=text_scale,
433
  ip_scale=ip_scale,
 
122
  text_encoder=None,
123
  text_encoder_2=None,
124
  vae=None,
125
+ unet=None,
126
  )
127
 
128
  '''
 
295
  outputs = model.generate(
296
  input_ids=input_ids,
297
  attention_mask=attention_mask,
298
+ max_new_tokens=512,
299
  temperature=0.2,
300
  top_p=0.9,
301
  do_sample=True,
 
308
  outputs_2 = model.generate(
309
  input_ids=input_ids_2,
310
  attention_mask=attention_mask_2,
311
+ max_new_tokens=512,
312
  temperature=0.2,
313
  top_p=0.9,
314
  do_sample=True,
 
412
  expand_prompt(prompt)
413
  expand_prompt(caption)
414
  expanded = expand_prompt(caption_2)
415
+ expanded_1 = expanded[0]
416
+ expanded_2 = expanded[1]
417
  del model
418
  del txt_tokenizer
419
  gc.collect()
 
429
  pil_image_3=sd_image_c,
430
  pil_image_4=sd_image_d,
431
  pil_image_5=sd_image_e,
432
+ prompt=prompt+' '+expanded_1,
433
+ prompt_2=expanded_2,
434
  negative_prompt=negative_prompt,
435
  text_scale=text_scale,
436
  ip_scale=ip_scale,