Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -9,18 +9,12 @@ from transformers import CLIPTextModel, CLIPTokenizer,T5EncoderModel, T5Tokenize
|
|
9 |
dtype = torch.bfloat16
|
10 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
|
12 |
-
|
13 |
-
adapter_id = "alimama-creative/FLUX.1-Turbo-Alpha"
|
14 |
-
|
15 |
-
pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=dtype).to(device)
|
16 |
-
pipe.load_lora_weights(adapter_id)
|
17 |
-
pipe.fuse_lora()
|
18 |
-
#pipe = DiffusionPipeline.from_pretrained("sayakpaul/FLUX.1-merged", torch_dtype=dtype).to(device)
|
19 |
|
20 |
MAX_SEED = np.iinfo(np.int32).max
|
21 |
MAX_IMAGE_SIZE = 2048
|
22 |
|
23 |
-
@spaces.GPU()
|
24 |
def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, guidance_scale=3.5, num_inference_steps=8, progress=gr.Progress(track_tqdm=True)):
|
25 |
if randomize_seed:
|
26 |
seed = random.randint(0, MAX_SEED)
|
|
|
9 |
dtype = torch.bfloat16
|
10 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
|
12 |
+
pipe = DiffusionPipeline.from_pretrained("sayakpaul/FLUX.1-merged", torch_dtype=dtype).to(device)
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
MAX_SEED = np.iinfo(np.int32).max
|
15 |
MAX_IMAGE_SIZE = 2048
|
16 |
|
17 |
+
@spaces.GPU(duration=21)
|
18 |
def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, guidance_scale=3.5, num_inference_steps=8, progress=gr.Progress(track_tqdm=True)):
|
19 |
if randomize_seed:
|
20 |
seed = random.randint(0, MAX_SEED)
|