Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,15 +13,17 @@ else:
|
|
13 |
|
14 |
# Initialize the base model and specific LoRA
|
15 |
base_model = "black-forest-labs/FLUX.1-dev"
|
|
|
|
|
|
|
16 |
pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=torch.float16)
|
17 |
|
18 |
# Check if CUDA is available and move the model to GPU if possible
|
19 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
20 |
pipe = pipe.to(device)
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
pipe.load_lora_weights(lora_repo)
|
25 |
|
26 |
MAX_SEED = 2**32-1
|
27 |
|
@@ -31,7 +33,7 @@ def run_lora(prompt, cfg_scale, steps, randomize_seed, seed, width, height, lora
|
|
31 |
generator = torch.Generator(device=device).manual_seed(seed)
|
32 |
progress(0, f"Starting image generation (using {device})...")
|
33 |
image = pipe(
|
34 |
-
prompt=
|
35 |
num_inference_steps=steps,
|
36 |
guidance_scale=cfg_scale,
|
37 |
width=width,
|
|
|
13 |
|
14 |
# Initialize the base model and specific LoRA
|
15 |
base_model = "black-forest-labs/FLUX.1-dev"
|
16 |
+
lora_model = "sagar007/sagar_flux"
|
17 |
+
|
18 |
+
# Load the base model
|
19 |
pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=torch.float16)
|
20 |
|
21 |
# Check if CUDA is available and move the model to GPU if possible
|
22 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
23 |
pipe = pipe.to(device)
|
24 |
|
25 |
+
# Load the LoRA weights
|
26 |
+
pipe.load_lora_weights(lora_model)
|
|
|
27 |
|
28 |
MAX_SEED = 2**32-1
|
29 |
|
|
|
33 |
generator = torch.Generator(device=device).manual_seed(seed)
|
34 |
progress(0, f"Starting image generation (using {device})...")
|
35 |
image = pipe(
|
36 |
+
prompt=prompt, # Remove the trigger word as it's part of the LoRA model
|
37 |
num_inference_steps=steps,
|
38 |
guidance_scale=cfg_scale,
|
39 |
width=width,
|