John6666 commited on
Commit
6242619
·
verified ·
1 Parent(s): cfd9973

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +376 -369
  2. requirements.txt +21 -21
app.py CHANGED
@@ -1,369 +1,376 @@
1
- import spaces
2
- import gradio as gr
3
- from gradio_imageslider import ImageSlider
4
- import torch
5
-
6
- torch.jit.script = lambda f: f
7
- from hidiffusion import apply_hidiffusion
8
- from diffusers import (
9
- ControlNetModel,
10
- StableDiffusionXLControlNetImg2ImgPipeline,
11
- DDIMScheduler,
12
- )
13
- from controlnet_aux import AnylineDetector
14
- from compel import Compel, ReturnedEmbeddingsType
15
- from PIL import Image
16
- import os
17
- import time
18
- import numpy as np
19
-
20
- IS_SPACES_ZERO = os.environ.get("SPACES_ZERO_GPU", "0") == "1"
21
- IS_SPACE = os.environ.get("SPACE_ID", None) is not None
22
-
23
- device = "cuda" if torch.cuda.is_available() else "cpu"
24
- dtype = torch.float16
25
-
26
- LOW_MEMORY = os.getenv("LOW_MEMORY", "0") == "1"
27
-
28
- print(f"device: {device}")
29
- print(f"dtype: {dtype}")
30
- print(f"low memory: {LOW_MEMORY}")
31
-
32
-
33
- model = "stabilityai/stable-diffusion-xl-base-1.0"
34
- # model = "stabilityai/sdxl-turbo"
35
- # vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=dtype)
36
- scheduler = DDIMScheduler.from_pretrained(model, subfolder="scheduler")
37
- # controlnet = ControlNetModel.from_pretrained(
38
- # "diffusers/controlnet-canny-sdxl-1.0", torch_dtype=torch.float16
39
- # )
40
- controlnet = ControlNetModel.from_pretrained(
41
- "TheMistoAI/MistoLine",
42
- torch_dtype=torch.float16,
43
- revision="refs/pr/3",
44
- variant="fp16",
45
- )
46
- pipe = StableDiffusionXLControlNetImg2ImgPipeline.from_pretrained(
47
- model,
48
- controlnet=controlnet,
49
- torch_dtype=dtype,
50
- variant="fp16",
51
- use_safetensors=True,
52
- scheduler=scheduler,
53
- )
54
-
55
- compel = Compel(
56
- tokenizer=[pipe.tokenizer, pipe.tokenizer_2],
57
- text_encoder=[pipe.text_encoder, pipe.text_encoder_2],
58
- returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED,
59
- requires_pooled=[False, True],
60
- )
61
- pipe = pipe.to(device)
62
-
63
- if not IS_SPACES_ZERO:
64
- apply_hidiffusion(pipe)
65
- # pipe.enable_xformers_memory_efficient_attention()
66
- pipe.enable_model_cpu_offload()
67
- pipe.enable_vae_tiling()
68
-
69
- anyline = AnylineDetector.from_pretrained(
70
- "TheMistoAI/MistoLine", filename="MTEED.pth", subfolder="Anyline"
71
- ).to(device)
72
-
73
-
74
- def pad_image(image):
75
- w, h = image.size
76
- if w == h:
77
- return image
78
- elif w > h:
79
- new_image = Image.new(image.mode, (w, w), (0, 0, 0))
80
- pad_w = 0
81
- pad_h = (w - h) // 2
82
- new_image.paste(image, (0, pad_h))
83
- return new_image
84
- else:
85
- new_image = Image.new(image.mode, (h, h), (0, 0, 0))
86
- pad_w = (h - w) // 2
87
- pad_h = 0
88
- new_image.paste(image, (pad_w, 0))
89
- return new_image
90
-
91
-
92
- @spaces.GPU(duration=120)
93
- def predict(
94
- input_image,
95
- prompt,
96
- negative_prompt,
97
- seed,
98
- guidance_scale=8.5,
99
- scale=2,
100
- controlnet_conditioning_scale=0.5,
101
- strength=1.0,
102
- controlnet_start=0.0,
103
- controlnet_end=1.0,
104
- guassian_sigma=2.0,
105
- intensity_threshold=3,
106
- progress=gr.Progress(track_tqdm=True),
107
- ):
108
- if IS_SPACES_ZERO:
109
- apply_hidiffusion(pipe)
110
- if input_image is None:
111
- raise gr.Error("Please upload an image.")
112
- padded_image = pad_image(input_image).resize((1024, 1024)).convert("RGB")
113
- conditioning, pooled = compel([prompt, negative_prompt])
114
- generator = torch.manual_seed(seed)
115
- last_time = time.time()
116
- anyline_image = anyline(
117
- padded_image,
118
- detect_resolution=1280,
119
- guassian_sigma=max(0.01, guassian_sigma),
120
- intensity_threshold=intensity_threshold,
121
- )
122
-
123
- images = pipe(
124
- image=padded_image,
125
- control_image=anyline_image,
126
- strength=strength,
127
- prompt_embeds=conditioning[0:1],
128
- pooled_prompt_embeds=pooled[0:1],
129
- negative_prompt_embeds=conditioning[1:2],
130
- negative_pooled_prompt_embeds=pooled[1:2],
131
- width=1024 * scale,
132
- height=1024 * scale,
133
- controlnet_conditioning_scale=float(controlnet_conditioning_scale),
134
- controlnet_start=float(controlnet_start),
135
- controlnet_end=float(controlnet_end),
136
- generator=generator,
137
- num_inference_steps=30,
138
- guidance_scale=guidance_scale,
139
- eta=1.0,
140
- )
141
- print(f"Time taken: {time.time() - last_time}")
142
- return (padded_image, images.images[0]), padded_image, anyline_image
143
-
144
-
145
- css = """
146
- #intro{
147
- # max-width: 32rem;
148
- # text-align: center;
149
- # margin: 0 auto;
150
- }
151
- """
152
-
153
- with gr.Blocks(css=css) as demo:
154
- gr.Markdown(
155
- """
156
- # Enhance This
157
- ### HiDiffusion SDXL
158
-
159
- [HiDiffusion](https://github.com/megvii-research/HiDiffusion) enables higher-resolution image generation.
160
- You can upload an initial image and prompt to generate an enhanced version.
161
- SDXL Controlnet [TheMistoAI/MistoLine](https://huggingface.co/TheMistoAI/MistoLine)
162
- [Duplicate Space](https://huggingface.co/spaces/radames/Enhance-This-HiDiffusion-SDXL?duplicate=true) to avoid the queue.
163
-
164
- <small>
165
- <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!
166
-
167
- </small>
168
- """,
169
- elem_id="intro",
170
- )
171
- with gr.Row():
172
- with gr.Column(scale=1):
173
- image_input = gr.Image(type="pil", label="Input Image")
174
- prompt = gr.Textbox(
175
- label="Prompt",
176
- info="The prompt is very important to get the desired results. Please try to describe the image as best as you can. Accepts Compel Syntax",
177
- )
178
- negative_prompt = gr.Textbox(
179
- label="Negative Prompt",
180
- value="blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
181
- )
182
- seed = gr.Slider(
183
- minimum=0,
184
- maximum=2**64 - 1,
185
- value=1415926535897932,
186
- step=1,
187
- label="Seed",
188
- randomize=True,
189
- )
190
- with gr.Accordion(label="Advanced", open=False):
191
- guidance_scale = gr.Slider(
192
- minimum=0,
193
- maximum=50,
194
- value=8.5,
195
- step=0.001,
196
- label="Guidance Scale",
197
- )
198
- scale = gr.Slider(
199
- minimum=1,
200
- maximum=5,
201
- value=2,
202
- step=1,
203
- label="Magnification Scale",
204
- interactive=not IS_SPACE,
205
- )
206
- controlnet_conditioning_scale = gr.Slider(
207
- minimum=0,
208
- maximum=1,
209
- step=0.001,
210
- value=0.5,
211
- label="ControlNet Conditioning Scale",
212
- )
213
- strength = gr.Slider(
214
- minimum=0,
215
- maximum=1,
216
- step=0.001,
217
- value=1,
218
- label="Strength",
219
- )
220
- controlnet_start = gr.Slider(
221
- minimum=0,
222
- maximum=1,
223
- step=0.001,
224
- value=0.0,
225
- label="ControlNet Start",
226
- )
227
- controlnet_end = gr.Slider(
228
- minimum=0.0,
229
- maximum=1.0,
230
- step=0.001,
231
- value=1.0,
232
- label="ControlNet End",
233
- )
234
- guassian_sigma = gr.Slider(
235
- minimum=0.01,
236
- maximum=10.0,
237
- step=0.1,
238
- value=2.0,
239
- label="(Anyline) Guassian Sigma",
240
- )
241
- intensity_threshold = gr.Slider(
242
- minimum=0,
243
- maximum=255,
244
- step=1,
245
- value=3,
246
- label="(Anyline) Intensity Threshold",
247
- )
248
-
249
- btn = gr.Button()
250
- with gr.Column(scale=2):
251
- with gr.Group():
252
- image_slider = ImageSlider(position=0.5)
253
- with gr.Row():
254
- padded_image = gr.Image(type="pil", label="Padded Image")
255
- anyline_image = gr.Image(type="pil", label="Anyline Image")
256
- inputs = [
257
- image_input,
258
- prompt,
259
- negative_prompt,
260
- seed,
261
- guidance_scale,
262
- scale,
263
- controlnet_conditioning_scale,
264
- strength,
265
- controlnet_start,
266
- controlnet_end,
267
- guassian_sigma,
268
- intensity_threshold,
269
- ]
270
- outputs = [image_slider, padded_image, anyline_image]
271
- btn.click(lambda x: None, inputs=None, outputs=image_slider).then(
272
- fn=predict, inputs=inputs, outputs=outputs
273
- )
274
- gr.Examples(
275
- fn=predict,
276
- inputs=inputs,
277
- outputs=outputs,
278
- examples=[
279
- [
280
- "./examples/lara.jpeg",
281
- "photography of lara croft 8k high definition award winning",
282
- "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
283
- 5436236241,
284
- 8.5,
285
- 2,
286
- 0.8,
287
- 1.0,
288
- 0.0,
289
- 0.9,
290
- 2,
291
- 3,
292
- ],
293
- [
294
- "./examples/cybetruck.jpeg",
295
- "photo of tesla cybertruck futuristic car 8k high definition on a sand dune in mars, future",
296
- "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
297
- 383472451451,
298
- 8.5,
299
- 2,
300
- 0.8,
301
- 0.8,
302
- 0.0,
303
- 0.9,
304
- 2,
305
- 3,
306
- ],
307
- [
308
- "./examples/jesus.png",
309
- "a photorealistic painting of Jesus Christ, 4k high definition",
310
- "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
311
- 13317204146129588000,
312
- 8.5,
313
- 2,
314
- 0.8,
315
- 0.8,
316
- 0.0,
317
- 0.9,
318
- 2,
319
- 3,
320
- ],
321
- [
322
- "./examples/anna-sullivan-DioLM8ViiO8-unsplash.jpg",
323
- "A crowded stadium with enthusiastic fans watching a daytime sporting event, the stands filled with colorful attire and the sun casting a warm glow",
324
- "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
325
- 5623124123512,
326
- 8.5,
327
- 2,
328
- 0.8,
329
- 0.8,
330
- 0.0,
331
- 0.9,
332
- 2,
333
- 3,
334
- ],
335
- [
336
- "./examples/img_aef651cb-2919-499d-aa49-6d4e2e21a56e_1024.jpg",
337
- "a large red flower on a black background 4k high definition",
338
- "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
339
- 23123412341234,
340
- 8.5,
341
- 2,
342
- 0.8,
343
- 0.8,
344
- 0.0,
345
- 0.9,
346
- 2,
347
- 3,
348
- ],
349
- [
350
- "./examples/huggingface.jpg",
351
- "photo realistic huggingface human emoji costume, round, yellow, (human skin)+++ (human texture)+++",
352
- "blurry, ugly, duplicate, poorly drawn, deformed, mosaic, emoji cartoon, drawing, pixelated",
353
- 12312353423,
354
- 15.206,
355
- 2,
356
- 0.364,
357
- 0.8,
358
- 0.0,
359
- 0.9,
360
- 2,
361
- 3,
362
- ],
363
- ],
364
- cache_examples="lazy",
365
- )
366
-
367
-
368
- demo.queue(api_open=False)
369
- demo.launch(show_api=False)
 
 
 
 
 
 
 
 
1
+ import os
2
+ if os.environ.get("SPACES_ZERO_GPU") is not None:
3
+ import spaces
4
+ else:
5
+ class spaces:
6
+ @staticmethod
7
+ def GPU(func):
8
+ def wrapper(*args, **kwargs):
9
+ return func(*args, **kwargs)
10
+ return wrapper
11
+ import gradio as gr
12
+ from gradio_imageslider import ImageSlider
13
+ import torch
14
+ torch.jit.script = lambda f: f
15
+ from hidiffusion import apply_hidiffusion
16
+ from diffusers import (
17
+ ControlNetModel,
18
+ StableDiffusionXLControlNetImg2ImgPipeline,
19
+ DDIMScheduler,
20
+ )
21
+ from controlnet_aux import AnylineDetector
22
+ from compel import Compel, ReturnedEmbeddingsType
23
+ from PIL import Image
24
+ import time
25
+ import numpy as np
26
+
27
+ IS_SPACES_ZERO = os.environ.get("SPACES_ZERO_GPU", "0") == "1"
28
+ IS_SPACE = os.environ.get("SPACE_ID", None) is not None
29
+
30
+ device = "cuda" if torch.cuda.is_available() else "cpu"
31
+ dtype = torch.float16
32
+
33
+ LOW_MEMORY = os.getenv("LOW_MEMORY", "0") == "1"
34
+
35
+ print(f"device: {device}")
36
+ print(f"dtype: {dtype}")
37
+ print(f"low memory: {LOW_MEMORY}")
38
+
39
+
40
+ model = "stabilityai/stable-diffusion-xl-base-1.0"
41
+ # model = "stabilityai/sdxl-turbo"
42
+ # vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=dtype)
43
+ scheduler = DDIMScheduler.from_pretrained(model, subfolder="scheduler")
44
+ # controlnet = ControlNetModel.from_pretrained(
45
+ # "diffusers/controlnet-canny-sdxl-1.0", torch_dtype=torch.float16
46
+ # )
47
+ controlnet = ControlNetModel.from_pretrained(
48
+ "TheMistoAI/MistoLine",
49
+ torch_dtype=torch.float16,
50
+ revision="refs/pr/3",
51
+ variant="fp16",
52
+ )
53
+ pipe = StableDiffusionXLControlNetImg2ImgPipeline.from_pretrained(
54
+ model,
55
+ controlnet=controlnet,
56
+ torch_dtype=dtype,
57
+ variant="fp16",
58
+ use_safetensors=True,
59
+ scheduler=scheduler,
60
+ )
61
+
62
+ compel = Compel(
63
+ tokenizer=[pipe.tokenizer, pipe.tokenizer_2],
64
+ text_encoder=[pipe.text_encoder, pipe.text_encoder_2],
65
+ returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED,
66
+ requires_pooled=[False, True],
67
+ )
68
+ pipe = pipe.to(device)
69
+
70
+ if not IS_SPACES_ZERO:
71
+ apply_hidiffusion(pipe)
72
+ # pipe.enable_xformers_memory_efficient_attention()
73
+ pipe.enable_model_cpu_offload()
74
+ pipe.enable_vae_tiling()
75
+
76
+ anyline = AnylineDetector.from_pretrained(
77
+ "TheMistoAI/MistoLine", filename="MTEED.pth", subfolder="Anyline"
78
+ ).to(device)
79
+
80
+
81
+ def pad_image(image):
82
+ w, h = image.size
83
+ if w == h:
84
+ return image
85
+ elif w > h:
86
+ new_image = Image.new(image.mode, (w, w), (0, 0, 0))
87
+ pad_w = 0
88
+ pad_h = (w - h) // 2
89
+ new_image.paste(image, (0, pad_h))
90
+ return new_image
91
+ else:
92
+ new_image = Image.new(image.mode, (h, h), (0, 0, 0))
93
+ pad_w = (h - w) // 2
94
+ pad_h = 0
95
+ new_image.paste(image, (pad_w, 0))
96
+ return new_image
97
+
98
+
99
+ @spaces.GPU(duration=120)
100
+ def predict(
101
+ input_image,
102
+ prompt,
103
+ negative_prompt,
104
+ seed,
105
+ guidance_scale=8.5,
106
+ scale=2,
107
+ controlnet_conditioning_scale=0.5,
108
+ strength=1.0,
109
+ controlnet_start=0.0,
110
+ controlnet_end=1.0,
111
+ guassian_sigma=2.0,
112
+ intensity_threshold=3,
113
+ progress=gr.Progress(track_tqdm=True),
114
+ ):
115
+ if IS_SPACES_ZERO:
116
+ apply_hidiffusion(pipe)
117
+ if input_image is None:
118
+ raise gr.Error("Please upload an image.")
119
+ padded_image = pad_image(input_image).resize((1024, 1024)).convert("RGB")
120
+ conditioning, pooled = compel([prompt, negative_prompt])
121
+ generator = torch.manual_seed(seed)
122
+ last_time = time.time()
123
+ anyline_image = anyline(
124
+ padded_image,
125
+ detect_resolution=1280,
126
+ guassian_sigma=max(0.01, guassian_sigma),
127
+ intensity_threshold=intensity_threshold,
128
+ )
129
+
130
+ images = pipe(
131
+ image=padded_image,
132
+ control_image=anyline_image,
133
+ strength=strength,
134
+ prompt_embeds=conditioning[0:1],
135
+ pooled_prompt_embeds=pooled[0:1],
136
+ negative_prompt_embeds=conditioning[1:2],
137
+ negative_pooled_prompt_embeds=pooled[1:2],
138
+ width=1024 * scale,
139
+ height=1024 * scale,
140
+ controlnet_conditioning_scale=float(controlnet_conditioning_scale),
141
+ controlnet_start=float(controlnet_start),
142
+ controlnet_end=float(controlnet_end),
143
+ generator=generator,
144
+ num_inference_steps=30,
145
+ guidance_scale=guidance_scale,
146
+ eta=1.0,
147
+ )
148
+ print(f"Time taken: {time.time() - last_time}")
149
+ return (padded_image, images.images[0]), padded_image, anyline_image
150
+
151
+
152
+ css = """
153
+ #intro{
154
+ # max-width: 32rem;
155
+ # text-align: center;
156
+ # margin: 0 auto;
157
+ }
158
+ """
159
+
160
+ with gr.Blocks(css=css) as demo:
161
+ gr.Markdown(
162
+ """
163
+ # Enhance This
164
+ ### HiDiffusion SDXL
165
+
166
+ [HiDiffusion](https://github.com/megvii-research/HiDiffusion) enables higher-resolution image generation.
167
+ You can upload an initial image and prompt to generate an enhanced version.
168
+ SDXL Controlnet [TheMistoAI/MistoLine](https://huggingface.co/TheMistoAI/MistoLine)
169
+ [Duplicate Space](https://huggingface.co/spaces/radames/Enhance-This-HiDiffusion-SDXL?duplicate=true) to avoid the queue.
170
+
171
+ <small>
172
+ <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!
173
+
174
+ </small>
175
+ """,
176
+ elem_id="intro",
177
+ )
178
+ with gr.Row():
179
+ with gr.Column(scale=1):
180
+ image_input = gr.Image(type="pil", label="Input Image")
181
+ prompt = gr.Textbox(
182
+ label="Prompt",
183
+ info="The prompt is very important to get the desired results. Please try to describe the image as best as you can. Accepts Compel Syntax",
184
+ )
185
+ negative_prompt = gr.Textbox(
186
+ label="Negative Prompt",
187
+ value="blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
188
+ )
189
+ seed = gr.Slider(
190
+ minimum=0,
191
+ maximum=2**64 - 1,
192
+ value=1415926535897932,
193
+ step=1,
194
+ label="Seed",
195
+ randomize=True,
196
+ )
197
+ with gr.Accordion(label="Advanced", open=False):
198
+ guidance_scale = gr.Slider(
199
+ minimum=0,
200
+ maximum=50,
201
+ value=8.5,
202
+ step=0.001,
203
+ label="Guidance Scale",
204
+ )
205
+ scale = gr.Slider(
206
+ minimum=1,
207
+ maximum=5,
208
+ value=2,
209
+ step=1,
210
+ label="Magnification Scale",
211
+ interactive=not IS_SPACE,
212
+ )
213
+ controlnet_conditioning_scale = gr.Slider(
214
+ minimum=0,
215
+ maximum=1,
216
+ step=0.001,
217
+ value=0.5,
218
+ label="ControlNet Conditioning Scale",
219
+ )
220
+ strength = gr.Slider(
221
+ minimum=0,
222
+ maximum=1,
223
+ step=0.001,
224
+ value=1,
225
+ label="Strength",
226
+ )
227
+ controlnet_start = gr.Slider(
228
+ minimum=0,
229
+ maximum=1,
230
+ step=0.001,
231
+ value=0.0,
232
+ label="ControlNet Start",
233
+ )
234
+ controlnet_end = gr.Slider(
235
+ minimum=0.0,
236
+ maximum=1.0,
237
+ step=0.001,
238
+ value=1.0,
239
+ label="ControlNet End",
240
+ )
241
+ guassian_sigma = gr.Slider(
242
+ minimum=0.01,
243
+ maximum=10.0,
244
+ step=0.1,
245
+ value=2.0,
246
+ label="(Anyline) Guassian Sigma",
247
+ )
248
+ intensity_threshold = gr.Slider(
249
+ minimum=0,
250
+ maximum=255,
251
+ step=1,
252
+ value=3,
253
+ label="(Anyline) Intensity Threshold",
254
+ )
255
+
256
+ btn = gr.Button()
257
+ with gr.Column(scale=2):
258
+ with gr.Group():
259
+ image_slider = ImageSlider(position=0.5)
260
+ with gr.Row():
261
+ padded_image = gr.Image(type="pil", label="Padded Image")
262
+ anyline_image = gr.Image(type="pil", label="Anyline Image")
263
+ inputs = [
264
+ image_input,
265
+ prompt,
266
+ negative_prompt,
267
+ seed,
268
+ guidance_scale,
269
+ scale,
270
+ controlnet_conditioning_scale,
271
+ strength,
272
+ controlnet_start,
273
+ controlnet_end,
274
+ guassian_sigma,
275
+ intensity_threshold,
276
+ ]
277
+ outputs = [image_slider, padded_image, anyline_image]
278
+ btn.click(lambda x: None, inputs=None, outputs=image_slider).then(
279
+ fn=predict, inputs=inputs, outputs=outputs
280
+ )
281
+ gr.Examples(
282
+ fn=predict,
283
+ inputs=inputs,
284
+ outputs=outputs,
285
+ examples=[
286
+ [
287
+ "./examples/lara.jpeg",
288
+ "photography of lara croft 8k high definition award winning",
289
+ "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
290
+ 5436236241,
291
+ 8.5,
292
+ 2,
293
+ 0.8,
294
+ 1.0,
295
+ 0.0,
296
+ 0.9,
297
+ 2,
298
+ 3,
299
+ ],
300
+ [
301
+ "./examples/cybetruck.jpeg",
302
+ "photo of tesla cybertruck futuristic car 8k high definition on a sand dune in mars, future",
303
+ "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
304
+ 383472451451,
305
+ 8.5,
306
+ 2,
307
+ 0.8,
308
+ 0.8,
309
+ 0.0,
310
+ 0.9,
311
+ 2,
312
+ 3,
313
+ ],
314
+ [
315
+ "./examples/jesus.png",
316
+ "a photorealistic painting of Jesus Christ, 4k high definition",
317
+ "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
318
+ 13317204146129588000,
319
+ 8.5,
320
+ 2,
321
+ 0.8,
322
+ 0.8,
323
+ 0.0,
324
+ 0.9,
325
+ 2,
326
+ 3,
327
+ ],
328
+ [
329
+ "./examples/anna-sullivan-DioLM8ViiO8-unsplash.jpg",
330
+ "A crowded stadium with enthusiastic fans watching a daytime sporting event, the stands filled with colorful attire and the sun casting a warm glow",
331
+ "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
332
+ 5623124123512,
333
+ 8.5,
334
+ 2,
335
+ 0.8,
336
+ 0.8,
337
+ 0.0,
338
+ 0.9,
339
+ 2,
340
+ 3,
341
+ ],
342
+ [
343
+ "./examples/img_aef651cb-2919-499d-aa49-6d4e2e21a56e_1024.jpg",
344
+ "a large red flower on a black background 4k high definition",
345
+ "blurry, ugly, duplicate, poorly drawn, deformed, mosaic",
346
+ 23123412341234,
347
+ 8.5,
348
+ 2,
349
+ 0.8,
350
+ 0.8,
351
+ 0.0,
352
+ 0.9,
353
+ 2,
354
+ 3,
355
+ ],
356
+ [
357
+ "./examples/huggingface.jpg",
358
+ "photo realistic huggingface human emoji costume, round, yellow, (human skin)+++ (human texture)+++",
359
+ "blurry, ugly, duplicate, poorly drawn, deformed, mosaic, emoji cartoon, drawing, pixelated",
360
+ 12312353423,
361
+ 15.206,
362
+ 2,
363
+ 0.364,
364
+ 0.8,
365
+ 0.0,
366
+ 0.9,
367
+ 2,
368
+ 3,
369
+ ],
370
+ ],
371
+ cache_examples="lazy",
372
+ )
373
+
374
+
375
+ demo.queue(api_open=False)
376
+ demo.launch(show_api=False)
requirements.txt CHANGED
@@ -1,22 +1,22 @@
1
- gradio==5.5.0
2
- accelerate
3
- transformers
4
- torchvision
5
- xformers
6
- accelerate
7
- invisible-watermark
8
- huggingface-hub
9
- hf-transfer
10
- gradio_imageslider==0.0.20
11
- compel
12
- opencv-python
13
- numpy
14
- diffusers==0.27.0
15
- transformers
16
- accelerate
17
- safetensors
18
- hidiffusion==0.1.8
19
- spaces
20
- torch==2.2
21
- controlnet-aux @ git+https://github.com/huggingface/controlnet_aux
22
  numpy<2
 
1
+ gradio==5.5.0
2
+ accelerate
3
+ transformers
4
+ torchvision
5
+ xformers
6
+ accelerate
7
+ invisible-watermark
8
+ huggingface-hub
9
+ hf-transfer
10
+ gradio_imageslider==0.0.20
11
+ compel
12
+ opencv-python
13
+ numpy
14
+ diffusers>=0.27.0
15
+ transformers
16
+ accelerate
17
+ safetensors
18
+ hidiffusion==0.1.8
19
+ spaces
20
+ torch==2.2
21
+ controlnet-aux @ git+https://github.com/huggingface/controlnet_aux
22
  numpy<2