Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -7,23 +7,21 @@ from diffusers import DiffusionPipeline, FlowMatchEulerDiscreteScheduler
|
|
7 |
import torch
|
8 |
|
9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
10 |
-
|
|
|
11 |
|
12 |
if torch.cuda.is_available():
|
13 |
-
torch_dtype = torch.
|
14 |
else:
|
15 |
torch_dtype = torch.float32
|
16 |
|
17 |
pipe = DiffusionPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
|
18 |
-
|
19 |
-
pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_pretrained(model_repo_id, subfolder="scheduler", shift=5)
|
20 |
-
|
21 |
pipe = pipe.to(device)
|
22 |
|
23 |
MAX_SEED = np.iinfo(np.int32).max
|
24 |
MAX_IMAGE_SIZE = 2048
|
25 |
|
26 |
-
@spaces.GPU(duration=
|
27 |
def infer(
|
28 |
prompt,
|
29 |
negative_prompt="",
|
|
|
7 |
import torch
|
8 |
|
9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
10 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
+
model_repo_id = "stabilityai/stable-diffusion-3.5-large-turbo"
|
12 |
|
13 |
if torch.cuda.is_available():
|
14 |
+
torch_dtype = torch.bfloat16
|
15 |
else:
|
16 |
torch_dtype = torch.float32
|
17 |
|
18 |
pipe = DiffusionPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
|
|
|
|
|
|
|
19 |
pipe = pipe.to(device)
|
20 |
|
21 |
MAX_SEED = np.iinfo(np.int32).max
|
22 |
MAX_IMAGE_SIZE = 2048
|
23 |
|
24 |
+
@spaces.GPU(duration=20)
|
25 |
def infer(
|
26 |
prompt,
|
27 |
negative_prompt="",
|