multimodalart HF staff commited on
Commit
99fe006
1 Parent(s): 00eccf2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -303,12 +303,12 @@ def get_huggingface_safetensors(link):
303
  image_url = f"https://huggingface.co/{link}/resolve/main/{image_elements[-1]}"
304
  except Exception as e:
305
  print(e)
306
- raise Exception("Invalid Hugging Face repository with a *.safetensors LoRA")
307
  if not safetensors_name:
308
- raise Exception("No *.safetensors file found in the repository")
309
  return split_link[1], link, safetensors_name, trigger_word, image_url
310
  else:
311
- raise Exception("Invalid Hugging Face repository link")
312
 
313
  def check_custom_model(link):
314
  if link.endswith(".safetensors"):
@@ -338,7 +338,7 @@ def add_custom_lora(custom_lora, selected_indices):
338
  existing_item_index = next((index for (index, item) in enumerate(loras) if item['repo'] == repo), None)
339
  if existing_item_index is None:
340
  new_item = {
341
- "image": image,
342
  "title": title,
343
  "repo": repo,
344
  "weights": path,
 
303
  image_url = f"https://huggingface.co/{link}/resolve/main/{image_elements[-1]}"
304
  except Exception as e:
305
  print(e)
306
+ raise gr.Error("Invalid Hugging Face repository with a *.safetensors LoRA")
307
  if not safetensors_name:
308
+ raise gr.Error("No *.safetensors file found in the repository")
309
  return split_link[1], link, safetensors_name, trigger_word, image_url
310
  else:
311
+ raise gr.Error("Invalid Hugging Face repository link")
312
 
313
  def check_custom_model(link):
314
  if link.endswith(".safetensors"):
 
338
  existing_item_index = next((index for (index, item) in enumerate(loras) if item['repo'] == repo), None)
339
  if existing_item_index is None:
340
  new_item = {
341
+ "image": image if image is not None else "",
342
  "title": title,
343
  "repo": repo,
344
  "weights": path,