radames commited on
Commit
56624ff
1 Parent(s): f4883aa
Files changed (27) hide show
  1. app.py +6 -6
  2. gradio_cached_examples/14/component 0/{351a0bfafaaecc7814de → 34ae88864c06bce42201}/image.png +2 -2
  3. gradio_cached_examples/14/component 0/{b34adaae151a4459167b → 6a8fb955ba369fe2bff7}/image.png +2 -2
  4. gradio_cached_examples/14/component 0/{b3e9f831c3822912c747 → 8e4db924fa065750593b}/image.png +2 -2
  5. gradio_cached_examples/14/component 0/{bdf0acf00cd9b1c85287 → c7aa01fd10d837382ac6}/image.png +2 -2
  6. gradio_cached_examples/14/component 0/e06cb354ee474e562e51/image.png +0 -3
  7. gradio_cached_examples/14/component 0/{b5498d7a96d85e965a9b → e0c00f0a8f703ea49012}/image.png +2 -2
  8. gradio_cached_examples/14/component 0/e5205e81a610f8fb1fec/image.png +3 -0
  9. gradio_cached_examples/14/component 1/1fe673be180a2c114760/img_63ac1a08-0343-4641-9a33-69f5962e3c0f_1024.jpg +0 -0
  10. gradio_cached_examples/14/component 1/2ec5e1f2c88500465499/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_1024.jpg +0 -0
  11. gradio_cached_examples/14/component 1/3c86c69e7b46e996c594/img_bf8b5bfd-5769-445e-8b04-398fa66b36b1_1024.jpg +0 -0
  12. gradio_cached_examples/14/component 1/80c60ae5d95083d0bcfc/img_f01a99d7-866a-47e1-8180-3343949327a5_2048.jpg +0 -0
  13. gradio_cached_examples/14/component 1/81bcf84a09b997759a80/img_63ac1a08-0343-4641-9a33-69f5962e3c0f_2048.jpg +0 -0
  14. gradio_cached_examples/14/component 1/8df9754c0e60183ba8f8/img_bf8b5bfd-5769-445e-8b04-398fa66b36b1_1024.jpg +0 -0
  15. gradio_cached_examples/14/component 1/af83d83b113405a7c44e/img_f01a99d7-866a-47e1-8180-3343949327a5_1024.jpg +0 -0
  16. gradio_cached_examples/14/component 1/ba436b05750aa6645214/img_63ac1a08-0343-4641-9a33-69f5962e3c0f_1024.jpg +0 -0
  17. gradio_cached_examples/14/component 1/c3184c09057d88474a33/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_2048.jpg +0 -0
  18. gradio_cached_examples/14/component 1/cdf61b32958e252f00b9/img_87222732-8f7b-4e26-bfa9-bd5842e2af61_2048.jpg +0 -0
  19. gradio_cached_examples/14/component 1/d20358db86db5687c4d3/img_87222732-8f7b-4e26-bfa9-bd5842e2af61_1024.jpg +0 -0
  20. gradio_cached_examples/14/component 1/d51a78500d54f78aef8f/img_2b3a159b-b19d-4810-8678-8dd6762db0c0_2048.jpg +0 -0
  21. gradio_cached_examples/14/component 1/e65a284b320cbb3a01a4/img_f01a99d7-866a-47e1-8180-3343949327a5_1024.jpg +0 -0
  22. gradio_cached_examples/14/component 1/e80581741e20de234eb8/img_bf8b5bfd-5769-445e-8b04-398fa66b36b1_2048.jpg +0 -0
  23. gradio_cached_examples/14/component 1/e96cc92c329d8c5f7b30/img_2b3a159b-b19d-4810-8678-8dd6762db0c0_1024.jpg +0 -0
  24. gradio_cached_examples/14/component 1/ec2cd95acdcb6c98d37e/img_2b3a159b-b19d-4810-8678-8dd6762db0c0_1024.jpg +0 -0
  25. gradio_cached_examples/14/component 1/ee84949074ae1250919e/img_87222732-8f7b-4e26-bfa9-bd5842e2af61_1024.jpg +0 -0
  26. gradio_cached_examples/14/component 1/f7634141a2c13b47adc3/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_1024.jpg +0 -0
  27. gradio_cached_examples/14/log.csv +3 -3
app.py CHANGED
@@ -4,12 +4,12 @@ import torch
4
  from diffusers import DiffusionPipeline, AutoencoderKL
5
  from PIL import Image
6
  from torchvision import transforms
7
- import numpy as np
8
  import tempfile
9
  import os
 
10
  import uuid
11
 
12
- TORCH_COMPILE = os.getenv("TORCH_COMPILE", "0") == "1"
13
 
14
  device = "cuda" if torch.cuda.is_available() else "cpu"
15
  dtype = torch.float16
@@ -25,8 +25,6 @@ pipe = DiffusionPipeline.from_pretrained(
25
  vae=vae,
26
  )
27
  pipe = pipe.to(device)
28
- if TORCH_COMPILE:
29
- pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
30
 
31
 
32
  def load_and_process_image(pil_image):
@@ -73,6 +71,7 @@ def predict(
73
  padded_image = pad_image(input_image).resize((1024, 1024)).convert("RGB")
74
  image_lr = load_and_process_image(padded_image).to(device)
75
  generator = torch.manual_seed(seed)
 
76
  images = pipe(
77
  prompt,
78
  negative_prompt=negative_prompt,
@@ -90,8 +89,9 @@ def predict(
90
  sigma=0.8,
91
  multi_decoder=True,
92
  show_image=False,
93
- lowvram=True,
94
  )
 
95
  images_path = tempfile.mkdtemp()
96
  paths = []
97
  uuid_name = uuid.uuid4()
@@ -149,7 +149,7 @@ with gr.Blocks(css=css) as demo:
149
  "./examples/lara.jpeg",
150
  "photography of lara croft 8k high definition award winning",
151
  "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
152
- 1415535897932,
153
  2,
154
  ],
155
  [
 
4
  from diffusers import DiffusionPipeline, AutoencoderKL
5
  from PIL import Image
6
  from torchvision import transforms
 
7
  import tempfile
8
  import os
9
+ import time
10
  import uuid
11
 
12
+ LOW_MEMORY = os.getenv("LOW_MEMORY", "0") == "1"
13
 
14
  device = "cuda" if torch.cuda.is_available() else "cpu"
15
  dtype = torch.float16
 
25
  vae=vae,
26
  )
27
  pipe = pipe.to(device)
 
 
28
 
29
 
30
  def load_and_process_image(pil_image):
 
71
  padded_image = pad_image(input_image).resize((1024, 1024)).convert("RGB")
72
  image_lr = load_and_process_image(padded_image).to(device)
73
  generator = torch.manual_seed(seed)
74
+ last_time = time.time()
75
  images = pipe(
76
  prompt,
77
  negative_prompt=negative_prompt,
 
89
  sigma=0.8,
90
  multi_decoder=True,
91
  show_image=False,
92
+ lowvram=LOW_MEMORY,
93
  )
94
+ print(f"Time taken: {time.time() - last_time}")
95
  images_path = tempfile.mkdtemp()
96
  paths = []
97
  uuid_name = uuid.uuid4()
 
149
  "./examples/lara.jpeg",
150
  "photography of lara croft 8k high definition award winning",
151
  "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
152
+ 1415926535897932,
153
  2,
154
  ],
155
  [
gradio_cached_examples/14/component 0/{351a0bfafaaecc7814de → 34ae88864c06bce42201}/image.png RENAMED
File without changes
gradio_cached_examples/14/component 0/{b34adaae151a4459167b → 6a8fb955ba369fe2bff7}/image.png RENAMED
File without changes
gradio_cached_examples/14/component 0/{b3e9f831c3822912c747 → 8e4db924fa065750593b}/image.png RENAMED
File without changes
gradio_cached_examples/14/component 0/{bdf0acf00cd9b1c85287 → c7aa01fd10d837382ac6}/image.png RENAMED
File without changes
gradio_cached_examples/14/component 0/e06cb354ee474e562e51/image.png DELETED

Git LFS Details

  • SHA256: 6dca4b940d346451f6cecf29ea90245757da495d7e9d02deefd56de7bb8db25b
  • Pointer size: 132 Bytes
  • Size of remote file: 3.44 MB
gradio_cached_examples/14/component 0/{b5498d7a96d85e965a9b → e0c00f0a8f703ea49012}/image.png RENAMED
File without changes
gradio_cached_examples/14/component 0/e5205e81a610f8fb1fec/image.png ADDED

Git LFS Details

  • SHA256: a2b758790bc27ca48f1580db14f5d1d22542d8fe670315fcaab4a69169fac588
  • Pointer size: 132 Bytes
  • Size of remote file: 3.44 MB
gradio_cached_examples/14/component 1/1fe673be180a2c114760/img_63ac1a08-0343-4641-9a33-69f5962e3c0f_1024.jpg ADDED
gradio_cached_examples/14/component 1/2ec5e1f2c88500465499/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_1024.jpg ADDED
gradio_cached_examples/14/component 1/3c86c69e7b46e996c594/img_bf8b5bfd-5769-445e-8b04-398fa66b36b1_1024.jpg DELETED
Binary file (65.6 kB)
 
gradio_cached_examples/14/component 1/80c60ae5d95083d0bcfc/img_f01a99d7-866a-47e1-8180-3343949327a5_2048.jpg ADDED
gradio_cached_examples/14/component 1/81bcf84a09b997759a80/img_63ac1a08-0343-4641-9a33-69f5962e3c0f_2048.jpg ADDED
gradio_cached_examples/14/component 1/8df9754c0e60183ba8f8/img_bf8b5bfd-5769-445e-8b04-398fa66b36b1_1024.jpg DELETED
Binary file (65.6 kB)
 
gradio_cached_examples/14/component 1/af83d83b113405a7c44e/img_f01a99d7-866a-47e1-8180-3343949327a5_1024.jpg ADDED
gradio_cached_examples/14/component 1/ba436b05750aa6645214/img_63ac1a08-0343-4641-9a33-69f5962e3c0f_1024.jpg ADDED
gradio_cached_examples/14/component 1/c3184c09057d88474a33/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_2048.jpg ADDED
gradio_cached_examples/14/component 1/cdf61b32958e252f00b9/img_87222732-8f7b-4e26-bfa9-bd5842e2af61_2048.jpg DELETED
Binary file (245 kB)
 
gradio_cached_examples/14/component 1/d20358db86db5687c4d3/img_87222732-8f7b-4e26-bfa9-bd5842e2af61_1024.jpg DELETED
Binary file (65.5 kB)
 
gradio_cached_examples/14/component 1/d51a78500d54f78aef8f/img_2b3a159b-b19d-4810-8678-8dd6762db0c0_2048.jpg DELETED
Binary file (143 kB)
 
gradio_cached_examples/14/component 1/e65a284b320cbb3a01a4/img_f01a99d7-866a-47e1-8180-3343949327a5_1024.jpg ADDED
gradio_cached_examples/14/component 1/e80581741e20de234eb8/img_bf8b5bfd-5769-445e-8b04-398fa66b36b1_2048.jpg DELETED
Binary file (166 kB)
 
gradio_cached_examples/14/component 1/e96cc92c329d8c5f7b30/img_2b3a159b-b19d-4810-8678-8dd6762db0c0_1024.jpg DELETED
Binary file (47.1 kB)
 
gradio_cached_examples/14/component 1/ec2cd95acdcb6c98d37e/img_2b3a159b-b19d-4810-8678-8dd6762db0c0_1024.jpg DELETED
Binary file (47.1 kB)
 
gradio_cached_examples/14/component 1/ee84949074ae1250919e/img_87222732-8f7b-4e26-bfa9-bd5842e2af61_1024.jpg DELETED
Binary file (65.5 kB)
 
gradio_cached_examples/14/component 1/f7634141a2c13b47adc3/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_1024.jpg ADDED
gradio_cached_examples/14/log.csv CHANGED
@@ -1,4 +1,4 @@
1
  component 0,component 1,flag,username,timestamp
2
- "[{""path"":""gradio_cached_examples/14/component 0/b5498d7a96d85e965a9b/image.png"",""url"":null,""size"":null,""orig_name"":null,""mime_type"":null},{""path"":""gradio_cached_examples/14/component 0/b34adaae151a4459167b/image.png"",""url"":null,""size"":null,""orig_name"":null,""mime_type"":null}]","[{""path"":""gradio_cached_examples/14/component 1/8df9754c0e60183ba8f8/img_bf8b5bfd-5769-445e-8b04-398fa66b36b1_1024.jpg"",""url"":null,""size"":65560,""orig_name"":""img_bf8b5bfd-5769-445e-8b04-398fa66b36b1_1024.jpg"",""mime_type"":null},{""path"":""gradio_cached_examples/14/component 1/3c86c69e7b46e996c594/img_bf8b5bfd-5769-445e-8b04-398fa66b36b1_1024.jpg"",""url"":null,""size"":65560,""orig_name"":""img_bf8b5bfd-5769-445e-8b04-398fa66b36b1_1024.jpg"",""mime_type"":null},{""path"":""gradio_cached_examples/14/component 1/e80581741e20de234eb8/img_bf8b5bfd-5769-445e-8b04-398fa66b36b1_2048.jpg"",""url"":null,""size"":165512,""orig_name"":""img_bf8b5bfd-5769-445e-8b04-398fa66b36b1_2048.jpg"",""mime_type"":null}]",,,2023-12-06 19:52:37.669846
3
- "[{""path"":""gradio_cached_examples/14/component 0/351a0bfafaaecc7814de/image.png"",""url"":null,""size"":null,""orig_name"":null,""mime_type"":null},{""path"":""gradio_cached_examples/14/component 0/e06cb354ee474e562e51/image.png"",""url"":null,""size"":null,""orig_name"":null,""mime_type"":null}]","[{""path"":""gradio_cached_examples/14/component 1/ee84949074ae1250919e/img_87222732-8f7b-4e26-bfa9-bd5842e2af61_1024.jpg"",""url"":null,""size"":65506,""orig_name"":""img_87222732-8f7b-4e26-bfa9-bd5842e2af61_1024.jpg"",""mime_type"":null},{""path"":""gradio_cached_examples/14/component 1/d20358db86db5687c4d3/img_87222732-8f7b-4e26-bfa9-bd5842e2af61_1024.jpg"",""url"":null,""size"":65506,""orig_name"":""img_87222732-8f7b-4e26-bfa9-bd5842e2af61_1024.jpg"",""mime_type"":null},{""path"":""gradio_cached_examples/14/component 1/cdf61b32958e252f00b9/img_87222732-8f7b-4e26-bfa9-bd5842e2af61_2048.jpg"",""url"":null,""size"":244888,""orig_name"":""img_87222732-8f7b-4e26-bfa9-bd5842e2af61_2048.jpg"",""mime_type"":null}]",,,2023-12-06 19:53:55.398688
4
- "[{""path"":""gradio_cached_examples/14/component 0/bdf0acf00cd9b1c85287/image.png"",""url"":null,""size"":null,""orig_name"":null,""mime_type"":null},{""path"":""gradio_cached_examples/14/component 0/b3e9f831c3822912c747/image.png"",""url"":null,""size"":null,""orig_name"":null,""mime_type"":null}]","[{""path"":""gradio_cached_examples/14/component 1/e96cc92c329d8c5f7b30/img_2b3a159b-b19d-4810-8678-8dd6762db0c0_1024.jpg"",""url"":null,""size"":47077,""orig_name"":""img_2b3a159b-b19d-4810-8678-8dd6762db0c0_1024.jpg"",""mime_type"":null},{""path"":""gradio_cached_examples/14/component 1/ec2cd95acdcb6c98d37e/img_2b3a159b-b19d-4810-8678-8dd6762db0c0_1024.jpg"",""url"":null,""size"":47077,""orig_name"":""img_2b3a159b-b19d-4810-8678-8dd6762db0c0_1024.jpg"",""mime_type"":null},{""path"":""gradio_cached_examples/14/component 1/d51a78500d54f78aef8f/img_2b3a159b-b19d-4810-8678-8dd6762db0c0_2048.jpg"",""url"":null,""size"":143073,""orig_name"":""img_2b3a159b-b19d-4810-8678-8dd6762db0c0_2048.jpg"",""mime_type"":null}]",,,2023-12-06 19:55:13.167461
 
1
  component 0,component 1,flag,username,timestamp
2
+ "[{""path"":""gradio_cached_examples/14/component 0/34ae88864c06bce42201/image.png"",""url"":null,""size"":null,""orig_name"":null,""mime_type"":null},{""path"":""gradio_cached_examples/14/component 0/6a8fb955ba369fe2bff7/image.png"",""url"":null,""size"":null,""orig_name"":null,""mime_type"":null}]","[{""path"":""gradio_cached_examples/14/component 1/ba436b05750aa6645214/img_63ac1a08-0343-4641-9a33-69f5962e3c0f_1024.jpg"",""url"":null,""size"":60364,""orig_name"":""img_63ac1a08-0343-4641-9a33-69f5962e3c0f_1024.jpg"",""mime_type"":null},{""path"":""gradio_cached_examples/14/component 1/1fe673be180a2c114760/img_63ac1a08-0343-4641-9a33-69f5962e3c0f_1024.jpg"",""url"":null,""size"":60364,""orig_name"":""img_63ac1a08-0343-4641-9a33-69f5962e3c0f_1024.jpg"",""mime_type"":null},{""path"":""gradio_cached_examples/14/component 1/81bcf84a09b997759a80/img_63ac1a08-0343-4641-9a33-69f5962e3c0f_2048.jpg"",""url"":null,""size"":165825,""orig_name"":""img_63ac1a08-0343-4641-9a33-69f5962e3c0f_2048.jpg"",""mime_type"":null}]",,,2023-12-06 21:13:01.073568
3
+ "[{""path"":""gradio_cached_examples/14/component 0/c7aa01fd10d837382ac6/image.png"",""url"":null,""size"":null,""orig_name"":null,""mime_type"":null},{""path"":""gradio_cached_examples/14/component 0/e5205e81a610f8fb1fec/image.png"",""url"":null,""size"":null,""orig_name"":null,""mime_type"":null}]","[{""path"":""gradio_cached_examples/14/component 1/e65a284b320cbb3a01a4/img_f01a99d7-866a-47e1-8180-3343949327a5_1024.jpg"",""url"":null,""size"":62591,""orig_name"":""img_f01a99d7-866a-47e1-8180-3343949327a5_1024.jpg"",""mime_type"":null},{""path"":""gradio_cached_examples/14/component 1/af83d83b113405a7c44e/img_f01a99d7-866a-47e1-8180-3343949327a5_1024.jpg"",""url"":null,""size"":62591,""orig_name"":""img_f01a99d7-866a-47e1-8180-3343949327a5_1024.jpg"",""mime_type"":null},{""path"":""gradio_cached_examples/14/component 1/80c60ae5d95083d0bcfc/img_f01a99d7-866a-47e1-8180-3343949327a5_2048.jpg"",""url"":null,""size"":237148,""orig_name"":""img_f01a99d7-866a-47e1-8180-3343949327a5_2048.jpg"",""mime_type"":null}]",,,2023-12-06 21:14:31.614495
4
+ "[{""path"":""gradio_cached_examples/14/component 0/e0c00f0a8f703ea49012/image.png"",""url"":null,""size"":null,""orig_name"":null,""mime_type"":null},{""path"":""gradio_cached_examples/14/component 0/8e4db924fa065750593b/image.png"",""url"":null,""size"":null,""orig_name"":null,""mime_type"":null}]","[{""path"":""gradio_cached_examples/14/component 1/2ec5e1f2c88500465499/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_1024.jpg"",""url"":null,""size"":46209,""orig_name"":""img_85fe280c-8029-4c93-b776-4e4ed89f7a49_1024.jpg"",""mime_type"":null},{""path"":""gradio_cached_examples/14/component 1/f7634141a2c13b47adc3/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_1024.jpg"",""url"":null,""size"":46209,""orig_name"":""img_85fe280c-8029-4c93-b776-4e4ed89f7a49_1024.jpg"",""mime_type"":null},{""path"":""gradio_cached_examples/14/component 1/c3184c09057d88474a33/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_2048.jpg"",""url"":null,""size"":145141,""orig_name"":""img_85fe280c-8029-4c93-b776-4e4ed89f7a49_2048.jpg"",""mime_type"":null}]",,,2023-12-06 21:16:02.149295