lichorosario commited on
Commit
f1d8cc5
1 Parent(s): 8301efa

Update app.py

Browse files

Use md5 of the prompt, in order to allow longer prompts the doesn't give an error because of a long filename

Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -29,6 +29,7 @@ import random
29
  import warnings
30
  from transformers import CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer
31
  from utils import *
 
32
 
33
  from diffusers.image_processor import VaeImageProcessor
34
  from diffusers.loaders import (
@@ -1637,6 +1638,9 @@ if __name__ == "__main__":
1637
  generator = generator.manual_seed(seed)
1638
 
1639
  print(f"Prompt: {prompt}")
 
 
 
1640
  images = pipe(prompt,
1641
  negative_prompt=args.negative_prompt,
1642
  generator=generator,
@@ -1659,7 +1663,7 @@ if __name__ == "__main__":
1659
  use_progressive_upscaling=args.use_progressive_upscaling,
1660
  use_dilated_sampling=args.use_dilated_sampling,
1661
  shuffle=args.shuffle,
1662
- result_path=f"./output/{args.experiment_name}/{prompt}/{width}_{height}_{seed}/",
1663
  debug=args.debug, save_attention_map=args.save_attention_map, use_md_prompt=args.use_md_prompt, c=args.c
1664
  )
1665
  print(images)
 
29
  import warnings
30
  from transformers import CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer
31
  from utils import *
32
+ import hashlib
33
 
34
  from diffusers.image_processor import VaeImageProcessor
35
  from diffusers.loaders import (
 
1638
  generator = generator.manual_seed(seed)
1639
 
1640
  print(f"Prompt: {prompt}")
1641
+ md5_hash = hashlib.md5(prompt.encode()).hexdigest()
1642
+ result_path = f"./output/{args.experiment_name}/{md5_hash}/{width}_{height}_{seed}/"
1643
+
1644
  images = pipe(prompt,
1645
  negative_prompt=args.negative_prompt,
1646
  generator=generator,
 
1663
  use_progressive_upscaling=args.use_progressive_upscaling,
1664
  use_dilated_sampling=args.use_dilated_sampling,
1665
  shuffle=args.shuffle,
1666
+ result_path=result_path,
1667
  debug=args.debug, save_attention_map=args.save_attention_map, use_md_prompt=args.use_md_prompt, c=args.c
1668
  )
1669
  print(images)