fix: external lora takes in value outside of default

This commit is contained in:
nick 2024-04-24 17:35:09 -07:00
parent 797180b5c7
commit c843926d6e

View File

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