radames commited on
Commit
74a2acd
1 Parent(s): e68b44c

multi_decoder

Browse files
Files changed (2) hide show
  1. app.py +16 -8
  2. requirements.txt +1 -1
app.py CHANGED
@@ -14,6 +14,10 @@ LOW_MEMORY = os.getenv("LOW_MEMORY", "0") == "1"
14
  device = "cuda" if torch.cuda.is_available() else "cpu"
15
  dtype = torch.float16
16
 
 
 
 
 
17
  vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=dtype)
18
  pipe = DiffusionPipeline.from_pretrained(
19
  "stabilityai/stable-diffusion-xl-base-1.0",
@@ -87,7 +91,7 @@ def predict(
87
  cosine_scale_2=1,
88
  cosine_scale_3=1,
89
  sigma=0.8,
90
- multi_decoder=True,
91
  show_image=False,
92
  lowvram=LOW_MEMORY,
93
  )
@@ -112,13 +116,17 @@ css = """
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",
@@ -172,8 +180,8 @@ You can upload an initial image and prompt to generate an enhanced version.
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",
@@ -186,8 +194,8 @@ You can upload an initial image and prompt to generate an enhanced version.
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
  ],
193
  inputs=inputs,
 
14
  device = "cuda" if torch.cuda.is_available() else "cpu"
15
  dtype = torch.float16
16
 
17
+ multi_decoder = (
18
+ torch.cuda.get_device_properties(0).total_memory < 18 * 1024 * 1024 * 1024
19
+ )
20
+
21
  vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=dtype)
22
  pipe = DiffusionPipeline.from_pretrained(
23
  "stabilityai/stable-diffusion-xl-base-1.0",
 
91
  cosine_scale_2=1,
92
  cosine_scale_3=1,
93
  sigma=0.8,
94
+ multi_decoder=multi_decoder,
95
  show_image=False,
96
  lowvram=LOW_MEMORY,
97
  )
 
116
  with gr.Blocks(css=css) as demo:
117
  gr.Markdown(
118
  """
119
+ # Enhance This
120
+ ### DemoFusion SDXL
121
 
122
+ [DemoFusion](https://ruoyidu.github.io/demofusion/demofusion.html) enables higher-resolution image generation.
123
  You can upload an initial image and prompt to generate an enhanced version.
124
  [Duplicate Space](https://huggingface.co/spaces/radames/Enhance-This-DemoFusion-SDXL?duplicate=true) to avoid the queue.
125
+ GPU Time Comparison: T4: - A10G: ~175s A100: RTX 4090: ~88.8s
126
+
127
  <small>
128
+ <b>Notes</b> 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!
129
+
130
  </small>
131
  """,
132
  elem_id="intro",
 
180
  "./examples/cybetruck.jpeg",
181
  "photo of tesla cybertruck futuristic car 8k high definition on a sand dune in mars, future",
182
  "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
183
+ 23232234234,
184
+ 2,
185
  ],
186
  [
187
  "./examples/jesus.png",
 
194
  "./examples/anna-sullivan-DioLM8ViiO8-unsplash.jpg",
195
  "A crowded stadium with enthusiastic fans watching a daytime sporting event, the stands filled with colorful attire and the sun casting a warm glow",
196
  "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
197
+ 12412356145,
198
+ 2,
199
  ],
200
  ],
201
  inputs=inputs,
requirements.txt CHANGED
@@ -10,4 +10,4 @@ accelerate
10
  invisible-watermark
11
  huggingface-hub
12
  hf-transfer
13
- https://huggingface.co/datasets/radames/gradio-components/resolve/main/gradio_imageslider-0.0.13-py3-none-any.whl
 
10
  invisible-watermark
11
  huggingface-hub
12
  hf-transfer
13
+ gradio_imageslider==0.0.14