multimodalart HF staff commited on
Commit
4800859
1 Parent(s): 2caf84c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -106,6 +106,10 @@ def get_huggingface_safetensors(link):
106
  split_link = link.split("/")
107
  if(len(split_link) == 2):
108
  model_card = ModelCard.load(link)
 
 
 
 
109
  image_path = model_card.data.get("widget", [{}])[0].get("output", {}).get("url", None)
110
  trigger_word = model_card.data.get("instance_prompt", "")
111
  image_url = f"https://huggingface.co/{link}/resolve/main/{image_path}" if image_path else None
@@ -120,8 +124,8 @@ def get_huggingface_safetensors(link):
120
  image_url = f"https://huggingface.co/{link}/resolve/main/{image_elements[-1]}"
121
  except Exception as e:
122
  print(e)
123
- gr.Warning(f"You didn't include a link neither a valid Hugging Face repository with a *.safetensors LoRA {e}")
124
- raise Exception(f"You didn't include a link neither a valid Hugging Face repository with a *.safetensors LoRA {e}")
125
  return split_link[1], link, safetensors_name, trigger_word, image_url
126
 
127
  def check_custom_model(link):
 
106
  split_link = link.split("/")
107
  if(len(split_link) == 2):
108
  model_card = ModelCard.load(link)
109
+ base_model = model_card.data.get("base_model")
110
+ print(base_model)
111
+ if((base_model != "black-forest-labs/FLUX.1-dev") and (base_model != "black-forest-labs/FLUX.1-schnell")):
112
+ raise Exception("Not a FLUX LoRA!")
113
  image_path = model_card.data.get("widget", [{}])[0].get("output", {}).get("url", None)
114
  trigger_word = model_card.data.get("instance_prompt", "")
115
  image_url = f"https://huggingface.co/{link}/resolve/main/{image_path}" if image_path else None
 
124
  image_url = f"https://huggingface.co/{link}/resolve/main/{image_elements[-1]}"
125
  except Exception as e:
126
  print(e)
127
+ gr.Warning(f"You didn't include a link neither a valid Hugging Face repository with a *.safetensors LoRA")
128
+ raise Exception(f"You didn't include a link neither a valid Hugging Face repository with a *.safetensors LoRA")
129
  return split_link[1], link, safetensors_name, trigger_word, image_url
130
 
131
  def check_custom_model(link):