huggingfaceaccount12 commited on
Commit
2534039
Β·
verified Β·
1 Parent(s): 860e92f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from diffusers.pipelines import FluxPipeline
3
+
4
+ model_id = "black-forest-labs/FLUX.1-dev"
5
+ adapter_id = "alimama-creative/FLUX.1-Turbo-Alpha"
6
+
7
+ pipe = FluxPipeline.from_pretrained(
8
+ model_id,
9
+ torch_dtype=torch.bfloat16
10
+ )
11
+ pipe.to("cuda")
12
+
13
+ pipe.load_lora_weights(adapter_id)
14
+ pipe.fuse_lora()
15
+
16
+ prompt = "A DSLR photo of a shiny VW van that has a cityscape painted on it. A smiling sloth stands on grass in front of the van and is wearing a leather jacket, a cowboy hat, a kilt and a bowtie. The sloth is holding a quarterstaff and a big book."
17
+ image = pipe(
18
+ prompt=prompt,
19
+ guidance_scale=3.5,
20
+ height=1024,
21
+ width=1024,
22
+ num_inference_steps=8,
23
+ max_sequence_length=512).images[0]