Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
MAX_SEED = np.iinfo(np.int32).max
|
15 |
MAX_IMAGE_SIZE = 2048
|
@@ -26,7 +32,8 @@ def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, guidan
|
|
26 |
height = height,
|
27 |
num_inference_steps = num_inference_steps,
|
28 |
generator = generator,
|
29 |
-
guidance_scale=guidance_scale
|
|
|
30 |
).images[0]
|
31 |
return image, seed
|
32 |
|
|
|
9 |
dtype = torch.bfloat16
|
10 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
|
12 |
+
model_id = "black-forest-labs/FLUX.1-dev"
|
13 |
+
adapter_id = "alimama-creative/FLUX.1-Turbo-Alpha"
|
14 |
+
|
15 |
+
pipe = FluxPipeline.from_pretrained(model_id, torch_dtype=dtype).to(device)
|
16 |
+
|
17 |
+
pipe.load_lora_weights(adapter_id)
|
18 |
+
pipe.fuse_lora()
|
19 |
|
20 |
MAX_SEED = np.iinfo(np.int32).max
|
21 |
MAX_IMAGE_SIZE = 2048
|
|
|
32 |
height = height,
|
33 |
num_inference_steps = num_inference_steps,
|
34 |
generator = generator,
|
35 |
+
guidance_scale=guidance_scale,
|
36 |
+
max_sequence_length=512
|
37 |
).images[0]
|
38 |
return image, seed
|
39 |
|