lichorosario commited on
Commit
04c94e7
·
verified ·
1 Parent(s): 2acc5da

Update app.py

Browse files

Applied the same bugfix that you did on flux lora the explorer because It's not loading any lora anymore.

Files changed (1) hide show
  1. app.py +7 -1
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
- if base_model not in ["black-forest-labs/FLUX.1-dev", "black-forest-labs/FLUX.1-schnell"]:
 
 
 
 
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