diff --git a/comfy-nodes/external_lora.py b/comfy-nodes/external_lora.py index 3488116..f186ba2 100644 --- a/comfy-nodes/external_lora.py +++ b/comfy-nodes/external_lora.py @@ -32,19 +32,22 @@ class ComfyUIDeployExternalLora: import os import uuid - if input_id and input_id.startswith('http'): - unique_filename = str(uuid.uuid4()) + ".safetensors" - print(unique_filename) - print(folder_paths.folder_names_and_paths["loras"][0][0]) - destination_path = os.path.join(folder_paths.folder_names_and_paths["loras"][0][0], unique_filename) - print(destination_path) - print("Downloading external lora - " + input_id + " to " + destination_path) - response = requests.get(input_id, headers={'User-Agent': 'Mozilla/5.0'}, allow_redirects=True) - with open(destination_path, 'wb') as out_file: - out_file.write(response.content) - return (unique_filename,) - else: - return (default_lora_name,) + if input_id: + if input_id.startswith('http'): + unique_filename = str(uuid.uuid4()) + ".safetensors" + print(unique_filename) + print(folder_paths.folder_names_and_paths["loras"][0][0]) + destination_path = os.path.join(folder_paths.folder_names_and_paths["loras"][0][0], unique_filename) + print(destination_path) + print("Downloading external lora - " + input_id + " to " + destination_path) + response = requests.get(input_id, headers={'User-Agent': 'Mozilla/5.0'}, allow_redirects=True) + with open(destination_path, 'wb') as out_file: + out_file.write(response.content) + return (unique_filename,) + else: + return (input_id,) + + return (default_lora_name,) NODE_CLASS_MAPPINGS = {"ComfyUIDeployExternalLora": ComfyUIDeployExternalLora}