Spaces:
Runtime error
Runtime error
iaaa
Browse files- app.py +9 -4
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -9,14 +9,19 @@ 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
|
| 16 |
|
| 17 |
-
|
| 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(
|
|
@@ -91,7 +96,7 @@ def predict(
|
|
| 91 |
cosine_scale_2=1,
|
| 92 |
cosine_scale_3=1,
|
| 93 |
sigma=0.8,
|
| 94 |
-
multi_decoder=
|
| 95 |
show_image=False,
|
| 96 |
lowvram=LOW_MEMORY,
|
| 97 |
)
|
|
@@ -122,7 +127,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 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: ~
|
| 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!
|
|
|
|
| 9 |
import time
|
| 10 |
import uuid
|
| 11 |
|
|
|
|
| 12 |
|
| 13 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 14 |
dtype = torch.float16
|
| 15 |
|
| 16 |
+
MULTI_DECODER = (
|
| 17 |
torch.cuda.get_device_properties(0).total_memory < 18 * 1024 * 1024 * 1024
|
| 18 |
)
|
| 19 |
+
LOW_MEMORY = os.getenv("LOW_MEMORY", not MULTI_DECODER) == "1"
|
| 20 |
+
|
| 21 |
+
print(f"device: {device}")
|
| 22 |
+
print(f"dtype: {dtype}")
|
| 23 |
+
print(f"multi decoder: {MULTI_DECODER}")
|
| 24 |
+
print(f"low memory: {LOW_MEMORY}")
|
| 25 |
|
| 26 |
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=dtype)
|
| 27 |
pipe = DiffusionPipeline.from_pretrained(
|
|
|
|
| 96 |
cosine_scale_2=1,
|
| 97 |
cosine_scale_3=1,
|
| 98 |
sigma=0.8,
|
| 99 |
+
multi_decoder=MULTI_DECODER,
|
| 100 |
show_image=False,
|
| 101 |
lowvram=LOW_MEMORY,
|
| 102 |
)
|
|
|
|
| 127 |
[DemoFusion](https://ruoyidu.github.io/demofusion/demofusion.html) enables higher-resolution image generation.
|
| 128 |
You can upload an initial image and prompt to generate an enhanced version.
|
| 129 |
[Duplicate Space](https://huggingface.co/spaces/radames/Enhance-This-DemoFusion-SDXL?duplicate=true) to avoid the queue.
|
| 130 |
+
GPU Time Comparison: T4: - A10G: ~175s A100: RTX 4090: ~48.1s
|
| 131 |
|
| 132 |
<small>
|
| 133 |
<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!
|
requirements.txt
CHANGED
|
@@ -10,4 +10,4 @@ accelerate
|
|
| 10 |
invisible-watermark
|
| 11 |
huggingface-hub
|
| 12 |
hf-transfer
|
| 13 |
-
gradio_imageslider
|
|
|
|
| 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
|