Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -21,8 +21,6 @@ ENABLE_CPU_OFFLOAD = os.getenv("ENABLE_CPU_OFFLOAD", "0") == "1"
|
|
21 |
|
22 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
23 |
|
24 |
-
NUM_IMAGES_PER_PROMPT = 1
|
25 |
-
|
26 |
if torch.cuda.is_available():
|
27 |
pipe = DiffusionPipeline.from_pretrained(
|
28 |
"sd-community/sdxl-flash",
|
@@ -38,7 +36,6 @@ if torch.cuda.is_available():
|
|
38 |
|
39 |
if USE_TORCH_COMPILE:
|
40 |
pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
41 |
-
pipe2.unet = torch.compile(pipe2.unet, mode="reduce-overhead", fullgraph=True)
|
42 |
print("Model Compiled!")
|
43 |
|
44 |
|
@@ -47,7 +44,6 @@ def save_image(img):
|
|
47 |
img.save(unique_name)
|
48 |
return unique_name
|
49 |
|
50 |
-
|
51 |
def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
52 |
if randomize_seed:
|
53 |
seed = random.randint(0, MAX_SEED)
|
@@ -92,12 +88,13 @@ def generate(
|
|
92 |
|
93 |
|
94 |
examples = [
|
95 |
-
"neon holography crystal cat",
|
96 |
"a cat eating a piece of cheese",
|
97 |
-
"
|
98 |
-
"a cartoon of a boy playing with a tiger",
|
99 |
"a cute robot artist painting on an easel, concept art",
|
100 |
-
|
|
|
|
|
101 |
]
|
102 |
|
103 |
css = '''
|
@@ -121,7 +118,7 @@ with gr.Blocks(css=css) as demo:
|
|
121 |
container=False,
|
122 |
)
|
123 |
run_button = gr.Button("Run", scale=0)
|
124 |
-
result = gr.
|
125 |
with gr.Accordion("Advanced options", open=False):
|
126 |
with gr.Row():
|
127 |
use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=True)
|
|
|
21 |
|
22 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
23 |
|
|
|
|
|
24 |
if torch.cuda.is_available():
|
25 |
pipe = DiffusionPipeline.from_pretrained(
|
26 |
"sd-community/sdxl-flash",
|
|
|
36 |
|
37 |
if USE_TORCH_COMPILE:
|
38 |
pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
|
|
39 |
print("Model Compiled!")
|
40 |
|
41 |
|
|
|
44 |
img.save(unique_name)
|
45 |
return unique_name
|
46 |
|
|
|
47 |
def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
48 |
if randomize_seed:
|
49 |
seed = random.randint(0, MAX_SEED)
|
|
|
88 |
|
89 |
|
90 |
examples = [
|
|
|
91 |
"a cat eating a piece of cheese",
|
92 |
+
"a ROBOT riding a blue horse on Mars, photorealistic",
|
93 |
+
"a cartoon of a boy playing with a tiger, wall painting",
|
94 |
"a cute robot artist painting on an easel, concept art",
|
95 |
+
"Astronaut in a jungle, cold color palette, oil pastel, detailed, 8k",
|
96 |
+
"An alien grasping a sign board contain word 'Flash', sketch, detailed",
|
97 |
+
"Kids going to school, Anime style"
|
98 |
]
|
99 |
|
100 |
css = '''
|
|
|
118 |
container=False,
|
119 |
)
|
120 |
run_button = gr.Button("Run", scale=0)
|
121 |
+
result = gr.Image(label="Result")
|
122 |
with gr.Accordion("Advanced options", open=False):
|
123 |
with gr.Row():
|
124 |
use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=True)
|