new
Browse files- README.md +2 -1
- app.py +30 -8
- examples/anna-sullivan-DioLM8ViiO8-unsplash.jpg +0 -0
- gradio_cached_examples/14/component 0/34ae88864c06bce42201/image.png +0 -3
- gradio_cached_examples/14/component 0/6a8fb955ba369fe2bff7/image.png +0 -3
- gradio_cached_examples/14/component 0/8e4db924fa065750593b/image.png +0 -3
- gradio_cached_examples/14/component 0/c7aa01fd10d837382ac6/image.png +0 -3
- gradio_cached_examples/14/component 0/e0c00f0a8f703ea49012/image.png +0 -3
- gradio_cached_examples/14/component 0/e5205e81a610f8fb1fec/image.png +0 -3
- gradio_cached_examples/14/component 1/1fe673be180a2c114760/img_63ac1a08-0343-4641-9a33-69f5962e3c0f_1024.jpg +0 -0
- gradio_cached_examples/14/component 1/2ec5e1f2c88500465499/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_1024.jpg +0 -0
- gradio_cached_examples/14/component 1/80c60ae5d95083d0bcfc/img_f01a99d7-866a-47e1-8180-3343949327a5_2048.jpg +0 -0
- gradio_cached_examples/14/component 1/81bcf84a09b997759a80/img_63ac1a08-0343-4641-9a33-69f5962e3c0f_2048.jpg +0 -0
- gradio_cached_examples/14/component 1/af83d83b113405a7c44e/img_f01a99d7-866a-47e1-8180-3343949327a5_1024.jpg +0 -0
- gradio_cached_examples/14/component 1/ba436b05750aa6645214/img_63ac1a08-0343-4641-9a33-69f5962e3c0f_1024.jpg +0 -0
- gradio_cached_examples/14/component 1/c3184c09057d88474a33/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_2048.jpg +0 -0
- gradio_cached_examples/14/component 1/e65a284b320cbb3a01a4/img_f01a99d7-866a-47e1-8180-3343949327a5_1024.jpg +0 -0
- gradio_cached_examples/14/component 1/f7634141a2c13b47adc3/img_85fe280c-8029-4c93-b776-4e4ed89f7a49_1024.jpg +0 -0
- gradio_cached_examples/14/log.csv +0 -4
- pipeline_demofusion_sdxl.py +2 -2
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
title:
|
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:
|
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 |
-
"""
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
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 |
-
|
160 |
-
|
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 |
-
|
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
|
gradio_cached_examples/14/component 0/6a8fb955ba369fe2bff7/image.png
DELETED
Git LFS Details
|
gradio_cached_examples/14/component 0/8e4db924fa065750593b/image.png
DELETED
Git LFS Details
|
gradio_cached_examples/14/component 0/c7aa01fd10d837382ac6/image.png
DELETED
Git LFS Details
|
gradio_cached_examples/14/component 0/e0c00f0a8f703ea49012/image.png
DELETED
Git LFS Details
|
gradio_cached_examples/14/component 0/e5205e81a610f8fb1fec/image.png
DELETED
Git LFS Details
|
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
|
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:
|