Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,15 +6,17 @@ import torch
|
|
6 |
from diffusers import DiffusionPipeline
|
7 |
|
8 |
dtype = torch.bfloat16
|
9 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
10 |
|
11 |
-
pipe
|
12 |
-
print(pipe.device)
|
13 |
MAX_SEED = np.iinfo(np.int32).max
|
14 |
MAX_IMAGE_SIZE = 2048
|
15 |
|
16 |
@spaces.GPU()
|
17 |
def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, num_inference_steps=4, progress=gr.Progress(track_tqdm=True)):
|
|
|
|
|
18 |
if randomize_seed:
|
19 |
seed = random.randint(0, MAX_SEED)
|
20 |
generator = torch.Generator().manual_seed(seed)
|
|
|
6 |
from diffusers import DiffusionPipeline
|
7 |
|
8 |
dtype = torch.bfloat16
|
9 |
+
#device = "cuda" if torch.cuda.is_available() else "cpu"
|
10 |
+
device = "cuda"
|
11 |
|
12 |
+
#print(pipe.device)
|
|
|
13 |
MAX_SEED = np.iinfo(np.int32).max
|
14 |
MAX_IMAGE_SIZE = 2048
|
15 |
|
16 |
@spaces.GPU()
|
17 |
def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, num_inference_steps=4, progress=gr.Progress(track_tqdm=True)):
|
18 |
+
pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=dtype).to(device)
|
19 |
+
|
20 |
if randomize_seed:
|
21 |
seed = random.randint(0, MAX_SEED)
|
22 |
generator = torch.Generator().manual_seed(seed)
|