Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -22,42 +22,19 @@ transformer = FluxTransformer2DModel.from_single_file(kontext_path, torch_dtype=
|
|
22 |
pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", transformer=transformer, torch_dtype=torch.bfloat16).to("cuda")
|
23 |
|
24 |
# Load LoRA data (you'll need to create this JSON file or modify to load your LoRAs)
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
flux_loras_raw = [
|
29 |
-
{
|
30 |
-
"image": item["image"],
|
31 |
-
"title": item["title"],
|
32 |
-
"repo": item["repo"],
|
33 |
-
"trigger_word": item.get("trigger_word", ""),
|
34 |
-
"weights": item.get("weights", "pytorch_lora_weights.safetensors"),
|
35 |
-
"likes": item.get("likes", 0),
|
36 |
-
"downloads": item.get("downloads", 0),
|
37 |
-
}
|
38 |
-
for item in data
|
39 |
-
]
|
40 |
-
except FileNotFoundError:
|
41 |
-
# Default LoRAs if JSON file doesn't exist
|
42 |
flux_loras_raw = [
|
43 |
{
|
44 |
-
"image": "
|
45 |
-
"title": "
|
46 |
-
"repo": "
|
47 |
-
"trigger_word": "
|
48 |
-
"
|
49 |
-
"
|
50 |
-
"downloads": 500,
|
51 |
-
},
|
52 |
-
{
|
53 |
-
"image": "https://via.placeholder.com/300x300?text=LoRA+2",
|
54 |
-
"title": "Example LoRA 2",
|
55 |
-
"repo": "example/lora2",
|
56 |
-
"trigger_word": "style2",
|
57 |
-
"weights": "pytorch_lora_weights.safetensors",
|
58 |
-
"likes": 80,
|
59 |
-
"downloads": 300,
|
60 |
}
|
|
|
61 |
]
|
62 |
|
63 |
# Global variables for LoRA management
|
|
|
22 |
pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", transformer=transformer, torch_dtype=torch.bfloat16).to("cuda")
|
23 |
|
24 |
# Load LoRA data (you'll need to create this JSON file or modify to load your LoRAs)
|
25 |
+
|
26 |
+
with open("flux_loras.json", "r") as file:
|
27 |
+
data = json.load(file)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
flux_loras_raw = [
|
29 |
{
|
30 |
+
"image": item["image"],
|
31 |
+
"title": item["title"],
|
32 |
+
"repo": item["repo"],
|
33 |
+
"trigger_word": item.get("trigger_word", ""),
|
34 |
+
"trigger_position": item.get("trigger_position", "prepend"),
|
35 |
+
"weights": item.get("weights", "pytorch_lora_weights.safetensors"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
37 |
+
for item in data
|
38 |
]
|
39 |
|
40 |
# Global variables for LoRA management
|