Spaces:
Running on Zero
Running on Zero
Choquin commited on
Update app.py
Browse filesApplied the same bugfix that you did on flux lora the explorer because It's not loading any lora anymore.
app.py
CHANGED
|
@@ -389,8 +389,14 @@ def get_huggingface_safetensors(link):
|
|
| 389 |
model_card = ModelCard.load(link)
|
| 390 |
base_model = model_card.data.get("base_model")
|
| 391 |
print(f"Base model: {base_model}")
|
| 392 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 393 |
raise Exception("Not a FLUX LoRA!")
|
|
|
|
|
|
|
| 394 |
image_path = model_card.data.get("widget", [{}])[0].get("output", {}).get("url", None)
|
| 395 |
trigger_word = model_card.data.get("instance_prompt", "")
|
| 396 |
image_url = f"https://huggingface.co/{link}/resolve/main/{image_path}" if image_path else None
|
|
|
|
| 389 |
model_card = ModelCard.load(link)
|
| 390 |
base_model = model_card.data.get("base_model")
|
| 391 |
print(f"Base model: {base_model}")
|
| 392 |
+
|
| 393 |
+
# Validate model type
|
| 394 |
+
acceptable_models = {"black-forest-labs/FLUX.1-dev", "black-forest-labs/FLUX.1-schnell"}
|
| 395 |
+
models_to_check = base_model if isinstance(base_model, list) else [base_model]
|
| 396 |
+
if not any(model in acceptable_models for model in models_to_check):
|
| 397 |
raise Exception("Not a FLUX LoRA!")
|
| 398 |
+
|
| 399 |
+
|
| 400 |
image_path = model_card.data.get("widget", [{}])[0].get("output", {}).get("url", None)
|
| 401 |
trigger_word = model_card.data.get("instance_prompt", "")
|
| 402 |
image_url = f"https://huggingface.co/{link}/resolve/main/{image_path}" if image_path else None
|