Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ import gradio as gr
|
|
8 |
import numpy as np
|
9 |
import uuid
|
10 |
import spaces
|
11 |
-
from diffusers import ConsistencyDecoderVAE, DPMSolverMultistepScheduler, Transformer2DModel, AutoencoderKL
|
12 |
import torch
|
13 |
from typing import Tuple
|
14 |
from datetime import datetime
|
@@ -93,7 +93,7 @@ style_list = [
|
|
93 |
styles = {k["name"]: (k["prompt"], k["negative_prompt"]) for k in style_list}
|
94 |
STYLE_NAMES = list(styles.keys())
|
95 |
DEFAULT_STYLE_NAME = "Realistic"
|
96 |
-
SCHEDULE_NAME = ["DPM-Solver"
|
97 |
DEFAULT_SCHEDULE_NAME = "DPM-Solver"
|
98 |
NUM_IMAGES_PER_PROMPT = 1
|
99 |
|
@@ -169,9 +169,7 @@ def generate(
|
|
169 |
height: int = 400,
|
170 |
schedule: str = 'DPM-Solver',
|
171 |
dpms_guidance_scale: float = 3.5,
|
172 |
-
sas_guidance_scale: float = 3,
|
173 |
dpms_inference_steps: int = 9,
|
174 |
-
sas_inference_steps: int = 25,
|
175 |
randomize_seed: bool = False,
|
176 |
use_resolution_binning: bool = True,
|
177 |
progress=gr.Progress(track_tqdm=True),
|
@@ -184,11 +182,6 @@ def generate(
|
|
184 |
pipe.scheduler = DPMSolverMultistepScheduler()
|
185 |
num_inference_steps = dpms_inference_steps
|
186 |
guidance_scale = dpms_guidance_scale
|
187 |
-
elif schedule == "SA-Solver":
|
188 |
-
if not isinstance(pipe.scheduler, SASolverScheduler):
|
189 |
-
pipe.scheduler = SASolverScheduler.from_config(pipe.scheduler.config, algorithm_type='data_prediction', tau_func=lambda t: 1 if 200 <= t <= 800 else 0, predictor_order=2, corrector_order=2)
|
190 |
-
num_inference_steps = sas_inference_steps
|
191 |
-
guidance_scale = sas_guidance_scale
|
192 |
else:
|
193 |
raise ValueError(f"Unknown schedule: {schedule}")
|
194 |
|
@@ -217,16 +210,6 @@ def generate(
|
|
217 |
|
218 |
examples = [
|
219 |
"A Monkey with a happy face in the Sahara desert.",
|
220 |
-
"Eiffel Tower was Made up of ICE to look like a cloud, with the bell tower at the top of the building.",
|
221 |
-
"3D small, round, fluffy creature with big, expressive eyes explores a vibrant, enchanted forest. The creature, a whimsical blend of a rabbit and a squirrel, has soft blue fur and a bushy, striped tail. It hops along a sparkling stream, its eyes wide with wonder. The forest is alive with magical elements: flowers that glow and change colors, trees with leaves in shades of purple and silver, and small floating lights that resemble fireflies. The creature stops to interact playfully with a group of tiny, fairy-like beings dancing around a mushroom ring. The creature looks up in awe at a large, glowing tree that seems to be the heart of the forest.",
|
222 |
-
"Color photo of a corgi made of transparent glass, standing on the riverside in Yosemite National Park.",
|
223 |
-
"A close-up photo of a woman. She wore a blue coat with a gray dress underneath. She has blue eyes and blond hair, and wears a pair of earrings. Behind are blurred city buildings and streets.",
|
224 |
-
"A litter of golden retriever puppies playing in the snow. Their heads pop out of the snow, covered in.",
|
225 |
-
"a handsome young boy in the middle with sky color background wearing eye glasses, it's super detailed with anime style, it's a portrait with delicated eyes and nice looking face",
|
226 |
-
"an astronaut sitting in a diner, eating fries, cinematic, analog film",
|
227 |
-
"Pirate ship trapped in a cosmic maelstrom nebula, rendered in cosmic beach whirlpool engine, volumetric lighting, spectacular, ambient lights, intricate detail.",
|
228 |
-
"professional portrait photo of an anthropomorphic cat wearing fancy gentleman hat and jacket walking in autumn forest.",
|
229 |
-
"Outside View from Hotel Made up of Chocolate in space.",
|
230 |
]
|
231 |
|
232 |
with gr.Blocks(css="style.css") as demo:
|
@@ -355,9 +338,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
355 |
height,
|
356 |
schedule,
|
357 |
dpms_guidance_scale,
|
358 |
-
sas_guidance_scale,
|
359 |
dpms_inference_steps,
|
360 |
-
sas_inference_steps,
|
361 |
randomize_seed,
|
362 |
],
|
363 |
outputs=[result, seed],
|
|
|
8 |
import numpy as np
|
9 |
import uuid
|
10 |
import spaces
|
11 |
+
from diffusers import ConsistencyDecoderVAE, DPMSolverMultistepScheduler, Transformer2DModel, AutoencoderKL
|
12 |
import torch
|
13 |
from typing import Tuple
|
14 |
from datetime import datetime
|
|
|
93 |
styles = {k["name"]: (k["prompt"], k["negative_prompt"]) for k in style_list}
|
94 |
STYLE_NAMES = list(styles.keys())
|
95 |
DEFAULT_STYLE_NAME = "Realistic"
|
96 |
+
SCHEDULE_NAME = ["DPM-Solver"]
|
97 |
DEFAULT_SCHEDULE_NAME = "DPM-Solver"
|
98 |
NUM_IMAGES_PER_PROMPT = 1
|
99 |
|
|
|
169 |
height: int = 400,
|
170 |
schedule: str = 'DPM-Solver',
|
171 |
dpms_guidance_scale: float = 3.5,
|
|
|
172 |
dpms_inference_steps: int = 9,
|
|
|
173 |
randomize_seed: bool = False,
|
174 |
use_resolution_binning: bool = True,
|
175 |
progress=gr.Progress(track_tqdm=True),
|
|
|
182 |
pipe.scheduler = DPMSolverMultistepScheduler()
|
183 |
num_inference_steps = dpms_inference_steps
|
184 |
guidance_scale = dpms_guidance_scale
|
|
|
|
|
|
|
|
|
|
|
185 |
else:
|
186 |
raise ValueError(f"Unknown schedule: {schedule}")
|
187 |
|
|
|
210 |
|
211 |
examples = [
|
212 |
"A Monkey with a happy face in the Sahara desert.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
]
|
214 |
|
215 |
with gr.Blocks(css="style.css") as demo:
|
|
|
338 |
height,
|
339 |
schedule,
|
340 |
dpms_guidance_scale,
|
|
|
341 |
dpms_inference_steps,
|
|
|
342 |
randomize_seed,
|
343 |
],
|
344 |
outputs=[result, seed],
|