fix: lora

This commit is contained in:
nick 2024-04-24 17:00:16 -07:00
parent 797180b5c7
commit 177010b0d4

View File

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