Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
9ca9af2
1
Parent(s):
3f0a0e5
Update app.py
Browse files
app.py
CHANGED
@@ -9,14 +9,13 @@ from transformers import CLIPTextModel, CLIPTokenizer,T5EncoderModel, T5Tokenize
|
|
9 |
dtype = torch.bfloat16
|
10 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
|
12 |
-
pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16, revision="refs/pr/3").to(
|
13 |
|
14 |
MAX_SEED = np.iinfo(np.int32).max
|
15 |
MAX_IMAGE_SIZE = 2048
|
16 |
|
17 |
@spaces.GPU(duration=190)
|
18 |
def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, guidance_scale=5.0, num_inference_steps=28, progress=gr.Progress(track_tqdm=True)):
|
19 |
-
pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16, revision="refs/pr/3").to("cuda")
|
20 |
if randomize_seed:
|
21 |
seed = random.randint(0, MAX_SEED)
|
22 |
generator = torch.Generator().manual_seed(seed)
|
|
|
9 |
dtype = torch.bfloat16
|
10 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
|
12 |
+
pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16, revision="refs/pr/3").to(device)
|
13 |
|
14 |
MAX_SEED = np.iinfo(np.int32).max
|
15 |
MAX_IMAGE_SIZE = 2048
|
16 |
|
17 |
@spaces.GPU(duration=190)
|
18 |
def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, guidance_scale=5.0, num_inference_steps=28, progress=gr.Progress(track_tqdm=True)):
|
|
|
19 |
if randomize_seed:
|
20 |
seed = random.randint(0, MAX_SEED)
|
21 |
generator = torch.Generator().manual_seed(seed)
|