radames commited on
Commit
7a485e5
1 Parent(s): 7ff868b
Files changed (20) hide show
  1. README.md +2 -1
  2. app.py +30 -8
  3. examples/anna-sullivan-DioLM8ViiO8-unsplash.jpg +0 -0
  4. gradio_cached_examples/14/component 0/34ae88864c06bce42201/image.png +0 -3
  5. gradio_cached_examples/14/component 0/6a8fb955ba369fe2bff7/image.png +0 -3
  6. gradio_cached_examples/14/component 0/8e4db924fa065750593b/image.png +0 -3
  7. gradio_cached_examples/14/component 0/c7aa01fd10d837382ac6/image.png +0 -3
  8. gradio_cached_examples/14/component 0/e0c00f0a8f703ea49012/image.png +0 -3
  9. gradio_cached_examples/14/component 0/e5205e81a610f8fb1fec/image.png +0 -3
  10. gradio_cached_examples/14/component 1/1fe673be180a2c114760/img_63ac1a08-0343-4641-9a33-69f5962e3c0f_1024.jpg +0 -0
  11. gradio_cached_examples/14/component 1/2ec5e1f2c88500465499/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_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/af83d83b113405a7c44e/img_f01a99d7-866a-47e1-8180-3343949327a5_1024.jpg +0 -0
  15. gradio_cached_examples/14/component 1/ba436b05750aa6645214/img_63ac1a08-0343-4641-9a33-69f5962e3c0f_1024.jpg +0 -0
  16. gradio_cached_examples/14/component 1/c3184c09057d88474a33/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_2048.jpg +0 -0
  17. gradio_cached_examples/14/component 1/e65a284b320cbb3a01a4/img_f01a99d7-866a-47e1-8180-3343949327a5_1024.jpg +0 -0
  18. gradio_cached_examples/14/component 1/f7634141a2c13b47adc3/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_1024.jpg +0 -0
  19. gradio_cached_examples/14/log.csv +0 -4
  20. pipeline_demofusion_sdxl.py +2 -2
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: Zoom and Enhance DemoFusion
3
  emoji: 🔍🕵️
4
  colorFrom: blue
5
  colorTo: red
@@ -7,6 +7,7 @@ sdk: gradio
7
  sdk_version: 4.8.0
8
  app_file: app.py
9
  pinned: false
 
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Enhance This DemoFusion SDXL
3
  emoji: 🔍🕵️
4
  colorFrom: blue
5
  colorTo: red
 
7
  sdk_version: 4.8.0
8
  app_file: app.py
9
  pinned: false
10
+ suggested_hardware: t4-medium
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py CHANGED
@@ -103,7 +103,7 @@ def predict(
103
 
104
  css = """
105
  #intro{
106
- max-width: 100%;
107
  text-align: center;
108
  margin: 0 auto;
109
  }
@@ -111,8 +111,16 @@ css = """
111
 
112
  with gr.Blocks(css=css) as demo:
113
  gr.Markdown(
114
- """# Super Resolution - SDXL
115
- ## [DemoFusion](https://github.com/PRIS-CV/DemoFusion)""",
 
 
 
 
 
 
 
 
116
  elem_id="intro",
117
  )
118
  with gr.Row():
@@ -126,7 +134,14 @@ with gr.Blocks(css=css) as demo:
126
  label="Negative Prompt",
127
  value="blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
128
  )
129
- scale = gr.Slider(minimum=2, maximum=5, value=2, step=1, label="x Scale")
 
 
 
 
 
 
 
130
  seed = gr.Slider(
131
  minimum=0,
132
  maximum=2**64 - 1,
@@ -140,6 +155,7 @@ with gr.Blocks(css=css) as demo:
140
  image_slider = ImageSlider()
141
  files = gr.Files()
142
  inputs = [image_input, prompt, negative_prompt, seed, scale]
 
143
  outputs = [image_slider, files]
144
  btn.click(predict, inputs=inputs, outputs=outputs, concurrency_limit=1)
145
  gr.Examples(
@@ -149,23 +165,29 @@ 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
- 1415926535897932,
153
  2,
154
  ],
155
  [
156
  "./examples/cybetruck.jpeg",
157
  "photo of tesla cybertruck futuristic car 8k high definition on a sand dune in mars, future",
158
  "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
159
- 1415535897932,
160
- 2,
161
  ],
162
  [
163
  "./examples/jesus.png",
164
  "a photorealistic painting of Jesus Christ, 4k high definition",
165
  "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
166
- 1415535897932,
167
  2,
168
  ],
 
 
 
 
 
 
169
  ],
170
  inputs=inputs,
171
  outputs=outputs,
 
103
 
104
  css = """
105
  #intro{
106
+ max-width: 32rem;
107
  text-align: center;
108
  margin: 0 auto;
109
  }
 
111
 
112
  with gr.Blocks(css=css) as demo:
113
  gr.Markdown(
114
+ """
115
+ # Zoom and Enhance with DemoFusion SDXL
116
+
117
+ [DemoFusion](https://github.com/PRIS-CV/DemoFusion) enables higher-resolution image generation.
118
+ You can upload an initial image and prompt to generate an enhanced version.
119
+ [Duplicate Space](https://huggingface.co/spaces/radames/Enhance-This-DemoFusion-SDXL?duplicate=true) to avoid the queue.
120
+ <small>
121
+ *Note*: The author advises against the term "super resolution" because it's more like image-to-image generation than enhancement, but it's still a lot of fun!
122
+ </small>
123
+ """,
124
  elem_id="intro",
125
  )
126
  with gr.Row():
 
134
  label="Negative Prompt",
135
  value="blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
136
  )
137
+ scale = gr.Slider(
138
+ minimum=1,
139
+ maximum=5,
140
+ value=2,
141
+ step=1,
142
+ label="x Scale",
143
+ interactive=False,
144
+ )
145
  seed = gr.Slider(
146
  minimum=0,
147
  maximum=2**64 - 1,
 
155
  image_slider = ImageSlider()
156
  files = gr.Files()
157
  inputs = [image_input, prompt, negative_prompt, seed, scale]
158
+ # inputs = [image_input, prompt, negative_prompt, seed]
159
  outputs = [image_slider, files]
160
  btn.click(predict, inputs=inputs, outputs=outputs, concurrency_limit=1)
161
  gr.Examples(
 
165
  "./examples/lara.jpeg",
166
  "photography of lara croft 8k high definition award winning",
167
  "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
168
+ 1528069323235669750,
169
  2,
170
  ],
171
  [
172
  "./examples/cybetruck.jpeg",
173
  "photo of tesla cybertruck futuristic car 8k high definition on a sand dune in mars, future",
174
  "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
175
+ 9257959681232992980,
176
+ 3,
177
  ],
178
  [
179
  "./examples/jesus.png",
180
  "a photorealistic painting of Jesus Christ, 4k high definition",
181
  "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
182
+ 13317204146129588000,
183
  2,
184
  ],
185
+ [
186
+ "./examples/anna-sullivan-DioLM8ViiO8-unsplash.jpg",
187
+ "A crowded stadium with enthusiastic fans watching a daytime sporting event, the stands filled with colorful attire and the sun casting a warm glow"
188
+ "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
189
+ 8398712905087378000,
190
+ 3
191
  ],
192
  inputs=inputs,
193
  outputs=outputs,
examples/anna-sullivan-DioLM8ViiO8-unsplash.jpg ADDED
gradio_cached_examples/14/component 0/34ae88864c06bce42201/image.png DELETED

Git LFS Details

  • SHA256: 340151dd01e9f5174e1370d77d20f6b74fb6dc8a816c09f3daafced6e7afbd27
  • Pointer size: 131 Bytes
  • Size of remote file: 851 kB
gradio_cached_examples/14/component 0/6a8fb955ba369fe2bff7/image.png DELETED

Git LFS Details

  • SHA256: 314a76cc2dfdd20d31c365aa87fb0801af78f028a4b638d3df9e67d2d064e875
  • Pointer size: 132 Bytes
  • Size of remote file: 4.21 MB
gradio_cached_examples/14/component 0/8e4db924fa065750593b/image.png DELETED

Git LFS Details

  • SHA256: 99505f4a18e0fe914e2440373b32d4ca3b4cefc43ced22af3fb45f0d6a4f4100
  • Pointer size: 132 Bytes
  • Size of remote file: 3.42 MB
gradio_cached_examples/14/component 0/c7aa01fd10d837382ac6/image.png DELETED

Git LFS Details

  • SHA256: 2f9061bd264e1a7da1b62aba9ab2cde83d4e288ade18e2843f3dbacca7e3fa93
  • Pointer size: 131 Bytes
  • Size of remote file: 703 kB
gradio_cached_examples/14/component 0/e0c00f0a8f703ea49012/image.png DELETED

Git LFS Details

  • SHA256: 0ae070d37b238a7915649b9d473f7e20388faa4c987639a7706b0714934f500d
  • Pointer size: 131 Bytes
  • Size of remote file: 688 kB
gradio_cached_examples/14/component 0/e5205e81a610f8fb1fec/image.png DELETED

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 DELETED
Binary file (60.4 kB)
 
gradio_cached_examples/14/component 1/2ec5e1f2c88500465499/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_1024.jpg DELETED
Binary file (46.2 kB)
 
gradio_cached_examples/14/component 1/80c60ae5d95083d0bcfc/img_f01a99d7-866a-47e1-8180-3343949327a5_2048.jpg DELETED
Binary file (237 kB)
 
gradio_cached_examples/14/component 1/81bcf84a09b997759a80/img_63ac1a08-0343-4641-9a33-69f5962e3c0f_2048.jpg DELETED
Binary file (166 kB)
 
gradio_cached_examples/14/component 1/af83d83b113405a7c44e/img_f01a99d7-866a-47e1-8180-3343949327a5_1024.jpg DELETED
Binary file (62.6 kB)
 
gradio_cached_examples/14/component 1/ba436b05750aa6645214/img_63ac1a08-0343-4641-9a33-69f5962e3c0f_1024.jpg DELETED
Binary file (60.4 kB)
 
gradio_cached_examples/14/component 1/c3184c09057d88474a33/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_2048.jpg DELETED
Binary file (145 kB)
 
gradio_cached_examples/14/component 1/e65a284b320cbb3a01a4/img_f01a99d7-866a-47e1-8180-3343949327a5_1024.jpg DELETED
Binary file (62.6 kB)
 
gradio_cached_examples/14/component 1/f7634141a2c13b47adc3/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_1024.jpg DELETED
Binary file (46.2 kB)
 
gradio_cached_examples/14/log.csv DELETED
@@ -1,4 +0,0 @@
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
 
 
 
 
 
pipeline_demofusion_sdxl.py CHANGED
@@ -16,7 +16,7 @@ import inspect
16
  import os
17
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
18
  import matplotlib.pyplot as plt
19
-
20
  import torch
21
  import torch.nn.functional as F
22
  import numpy as np
@@ -581,7 +581,7 @@ class DemoFusionSDXLPipeline(
581
  # DemoFusion specific checks
582
  if max(height, width) % 512 != 0:
583
  raise ValueError(
584
- f"the larger one of `height` and `width` has to be divisible by 1024 but are {height} and {width}."
585
  )
586
 
587
  if num_images_per_prompt != 1:
 
16
  import os
17
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
18
  import matplotlib.pyplot as plt
19
+ from PIL import Image
20
  import torch
21
  import torch.nn.functional as F
22
  import numpy as np
 
581
  # DemoFusion specific checks
582
  if max(height, width) % 512 != 0:
583
  raise ValueError(
584
+ f"the larger one of `height` and `width` has to be divisible by 512 but are {height} and {width}."
585
  )
586
 
587
  if num_images_per_prompt != 1: